fix(workspace): OFFSEC-003 rebase _sanitize_a2a to main space-substitution #469

Closed
fullstack-engineer wants to merge 1 commits from fix/455-offsec003-sanitize-alignment into staging

1 Commits

Author SHA1 Message Date
b331a0fc81 fix(workspace): OFFSEC-003 rebase _sanitize_a2a to main space-substitution
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 12s
sop-tier-check / tier-check (pull_request) Failing after 11s
audit-force-merge / audit (pull_request) Has been skipped
Issue #455. Align staging's sanitize_a2a_result with the main branch
approach so staging→main merge does not regress the OFFSEC-003
architecture.

Changes:
- Replace ZWSP (U+200B) escaping with simple str.replace
  space-substitution: "[/ A2A_RESULT_FROM_PEER]" and
  "[/ /A2A_RESULT_FROM_PEER]". ZWSP is invisible in most terminals
  and complicates debugging; space-substitution is equally effective
  and inspectable.
- Remove _strip_closed_blocks (defense-in-depth only, superseded by
  the primary escaping defense now applied first).
- Add regex-based injection-pattern escaping (SYSTEM, OVERRIDE,
  INSTRUCTIONS, IGNORE ALL, YOU ARE NOW) — matches main's approach.
- Update test_completed_response_sanitized to assert escaped forms
  are present (not raw), reflecting the correct OFFSEC-003 behaviour.
- Add dedicated test_sanitize_a2a.py covering boundary-marker escaping,
  injection-pattern escaping, and combined attacks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 12:01:14 +00:00