feat(player-connection): implement player connection history to detect alt accounts#249
Merged
Conversation
1b0da31 to
2f81374
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new persistence path for SRCDS “client connected” events so the system can build a historical record of player connections (intended to support alt-account detection).
Changes:
- Introduces a new core domain model + repository interface for
PlayerConnectionHistory. - Adds a SQLite-backed provider repository and a DB migration to store connection history.
- Wires the new repository into the UDP SRCDS command handler services and persists a record on
clientConnected.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/providers/src/repository/index.ts | Re-exports the new SQLite repository implementation. |
| packages/providers/src/repository/SQlitePlayerConnectionHistoryRepository.ts | Implements save() to insert connection history records into SQLite via Knex. |
| packages/entrypoints/src/udp/srcdsCommands/UDPCommandServices.ts | Extends UDP command DI services with PlayerConnectionHistoryRepository. |
| packages/entrypoints/src/udp/srcdsCommands/ClientConnected.ts | Persists connection history on client connect events. |
| packages/entrypoints/src/discordBot.ts | Instantiates/injects the new repository into the UDP listener. |
| packages/core/src/repository/PlayerConnectionHistoryRepository.ts | Adds core interface for persisting connection history. |
| packages/core/src/domain/index.ts | Exports the new PlayerConnectionHistory domain type. |
| packages/core/src/domain/PlayerConnectionHistory.ts | Defines the new domain model (steamId3, ip, nickname, timestamp). |
| packages/core/index.ts | Re-exports the new repository interface from the core package. |
| migrations/20260207160515_player_connection_history.ts | Adds the player_connection_history table. |
Comment on lines
+11
to
+15
| }); | ||
| } | ||
|
|
||
|
|
||
| export async function down(knex: Knex): Promise<void> { |
There was a problem hiding this comment.
This migration introduces persistent storage of players’ IP addresses and nicknames. Since IP addresses are sensitive personal data, consider adding a retention/cleanup strategy (e.g., periodic purge/TTL) and/or storing a privacy-preserving representation (hash/prefix) if full fidelity isn’t required for alt detection.
Suggested change
| }); | |
| } | |
| export async function down(knex: Knex): Promise<void> { | |
| }); | |
| // Enforce a retention policy for sensitive connection data (e.g., 90 days) | |
| // This SQLite trigger deletes records older than 90 days on each insert. | |
| await knex.raw(` | |
| CREATE TRIGGER IF NOT EXISTS player_connection_history_delete_old | |
| AFTER INSERT ON player_connection_history | |
| BEGIN | |
| DELETE FROM player_connection_history | |
| WHERE timestamp < datetime('now', '-90 days'); | |
| END; | |
| `); | |
| } | |
| export async function down(knex: Knex): Promise<void> { | |
| // Drop retention trigger before removing the table | |
| await knex.raw(`DROP TRIGGER IF EXISTS player_connection_history_delete_old;`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.