Skip to content

feat(player-connection): implement player connection history to detect alt accounts#249

Merged
sonikro merged 1 commit into
mainfrom
player-connection-history
Feb 7, 2026
Merged

feat(player-connection): implement player connection history to detect alt accounts#249
sonikro merged 1 commit into
mainfrom
player-connection-history

Conversation

@sonikro
Copy link
Copy Markdown
Owner

@sonikro sonikro commented Feb 7, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 7, 2026 16:14
@sonikro sonikro enabled auto-merge (squash) February 7, 2026 16:14
@sonikro sonikro force-pushed the player-connection-history branch from 1b0da31 to 2f81374 Compare February 7, 2026 16:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread packages/entrypoints/src/udp/srcdsCommands/ClientConnected.ts
Comment thread packages/entrypoints/src/udp/srcdsCommands/ClientConnected.ts
Comment on lines +11 to +15
});
}


export async function down(knex: Knex): Promise<void> {
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;`);

Copilot uses AI. Check for mistakes.
Comment thread packages/entrypoints/src/udp/srcdsCommands/ClientConnected.ts
@sonikro sonikro merged commit 16ebe4b into main Feb 7, 2026
9 checks passed
@sonikro sonikro deleted the player-connection-history branch February 7, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants