fix(publicenv): redact internal work context terms
All checks were successful
Code Review / ai-code-review (push) Successful in 12s
CD Pipeline / tests (push) Successful in 1m26s
CD Pipeline / build-and-deploy (push) Successful in 4m49s
CD Pipeline / post-deploy-checks (push) Successful in 1m40s

This commit is contained in:
Your Name
2026-06-13 05:40:57 +08:00
parent c30e95d220
commit e49c526ee7
2 changed files with 21 additions and 1 deletions

View File

@@ -38,6 +38,14 @@ _HOST_ALIASES = {
_PRIVATE_LAN_RE = re.compile(r"192\.168\.0\.\d{1,3}(?::\d{1,5})?")
_WORK_CONTEXT_REPLACEMENTS = {
"工作視窗": "內部協作環境",
"批准!繼續": "內部短訊指令",
"批准!": "內部短訊指令",
"source_thread_id": "redacted_thread_id",
"codex_delegation": "redacted_delegation",
}
def redact_public_lan_text(value: str) -> str:
"""Replace internal LAN addresses with public-safe asset aliases."""
@@ -52,7 +60,10 @@ def redact_public_lan_text(value: str) -> str:
redacted = redacted.replace(f"https://{host}", alias)
redacted = redacted.replace(host, alias)
return _PRIVATE_LAN_RE.sub("host:internal-node", redacted)
redacted = _PRIVATE_LAN_RE.sub("host:internal-node", redacted)
for phrase, replacement in _WORK_CONTEXT_REPLACEMENTS.items():
redacted = redacted.replace(phrase, replacement)
return redacted
def redact_public_lan_topology(value: Any) -> Any: