feat: align save-time redaction with codex v0.3.0 ProjectZomboidRedactor
Bumps the codex constraint from ^0.2.0 to ^0.3.0 to pull the PZ-B42 parser fix and the IP-redaction passes added in the codex v0.3.0 release. Wires codex's ProjectZomboidRedactor into the save-time Filter chain via a thin ProjectZomboidRedactorFilter wrapper, and removes the now-redundant IPv4Filter / IPv6Filter chain entries: - Codex's IPv4 / IPv6 redaction is generic-applicable (not PZ-only) and superior to the prior in-tree filters because it consumes the port suffix together with the address; previously only the IP was scrubbed, leaving e.g. ":27015" visible. - Codex additionally redacts PZ-specific PII the prior filters never touched (Steam IDs, player names, world coordinates). - The IPv4Filter and IPv6Filter source files are retained on disk for easy restore from history if a future paste type proves unsuitable for codex-driven IP scrubbing. UsernameFilter (OS-path username scrubbing — different concern from PZ player names) and AccessTokenFilter remain untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,8 +23,7 @@ abstract class Filter implements \JsonSerializable
|
||||
new TrimFilter(),
|
||||
new LimitBytesFilter(),
|
||||
new LimitLinesFilter(),
|
||||
new IPv4Filter(),
|
||||
new IPv6Filter(),
|
||||
new ProjectZomboidRedactorFilter(),
|
||||
new UsernameFilter(),
|
||||
new AccessTokenFilter(),
|
||||
];
|
||||
|
||||
45
src/Filter/ProjectZomboidRedactorFilter.php
Normal file
45
src/Filter/ProjectZomboidRedactorFilter.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace IndifferentKetchup\Iblogs\Filter;
|
||||
|
||||
use IndifferentKetchup\Codex\Util\ProjectZomboid\ProjectZomboidRedactor;
|
||||
|
||||
/**
|
||||
* Save-time wrapper that delegates to codex's ProjectZomboidRedactor.
|
||||
*
|
||||
* Codex owns the canonical Project Zomboid PII patterns (Steam IDs, player
|
||||
* names, world coordinates, plus IPv4 / IPv6 addresses with the v0.3.0
|
||||
* release). This filter is the single point at which PZ-shaped PII is
|
||||
* scrubbed on save; it replaces the previous IPv4Filter + IPv6Filter
|
||||
* stage (whose IP-only matches left port suffixes intact) and adds the
|
||||
* PZ-specific Steam ID, player-name, and coordinate redaction the generic
|
||||
* filters never touched.
|
||||
*
|
||||
* Codex's IPv4 / IPv6 regexes are generic and apply to non-PZ pastes too;
|
||||
* the PZ-specific regexes (Steam ID, player name, coords) mostly no-op on
|
||||
* non-PZ content because they rely on PZ-specific anchors (`76561198`,
|
||||
* the Steam-ID placeholder, `Combat:` / `Safety:` prefixes, `at` / `[`
|
||||
* coord wrappers + trailing PvP verbs).
|
||||
*
|
||||
* Patterns are encapsulated inside the codex redactor and are not exposed
|
||||
* to the client-side preview JS (`getData()` returns an empty array).
|
||||
* Server-side redaction on save is the privacy guarantee; the preview is
|
||||
* only a UX hint for users about what gets scrubbed.
|
||||
*/
|
||||
class ProjectZomboidRedactorFilter extends Filter
|
||||
{
|
||||
public function getType(): FilterType
|
||||
{
|
||||
return FilterType::REGEX;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function filter(string $data): string
|
||||
{
|
||||
return new ProjectZomboidRedactor()->redact($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user