feat: add Steam ID redaction pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 14:38:26 +00:00
parent 7755d8385c
commit 0c8dad9502
2 changed files with 59 additions and 1 deletions

View File

@@ -24,6 +24,12 @@ use IndifferentKetchup\Codex\Util\RedactorInterface;
*/
class ProjectZomboidRedactor implements RedactorInterface
{
/** Regex matching a 17-digit SteamID64 anchored on the 76561198 universe prefix, with lookaround boundaries that reject embedded occurrences. */
public const string STEAM_ID_REGEX = '/(?<![A-Za-z0-9])76561198\d{9}(?![A-Za-z0-9])/u';
/** Zeroed-out SteamID64 placeholder; syntactically valid but refers to no real account. */
public const string STEAM_ID_REPLACEMENT = '76561198000000000';
private bool $redactSteamIds = true;
private bool $redactPlayerNames = true;
private bool $redactCoordinates = true;
@@ -76,7 +82,7 @@ class ProjectZomboidRedactor implements RedactorInterface
public function redact(string $content): string
{
if ($this->redactSteamIds) {
// Steam ID pass added in Task 2
$content = preg_replace(self::STEAM_ID_REGEX, self::STEAM_ID_REPLACEMENT, $content);
}
if ($this->redactPlayerNames) {
// Player name pass added in Task 3