feat(security): implement Secret Masking in LLM Context Construction #656

Closed
CoreRasurae wants to merge 1 commits from feature/m4-secret-masking-llm-context into master

1 Commits

Author SHA1 Message Date
Luis Mendes 56f497e97f feat(security): implement Secret Masking in LLM Context Construction
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 6s
CI / typecheck (pull_request) Failing after 6s
CI / security (pull_request) Failing after 5s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 11s
CI / quality (pull_request) Failing after 14s
CI / build (pull_request) Failing after 15s
CI / unit_tests (pull_request) Failing after 18s
CI / docker (pull_request) Has been skipped
Implemented secret masking in the LLM context construction path to prevent
accidental exposure of sensitive data in LLM prompts:

- Added redact_context_for_llm() to shared/redaction.py using [REDACTED]
  replacement as specified by the architecture spec
- Wired redaction into the ACMS context assembly pipeline as a final pass
  before LLM prompt construction
- Applied redaction to fragment content and preamble in the ACMS pipeline
  before prompt inclusion
- Used negative lookbehind anchors on sk- and sk-ant- patterns to prevent
  false positives on common hyphenated words (e.g. task-type-classification)
- Added 11 Behave BDD scenarios covering both ACMSPipeline and
  ContextAssemblyPipeline secret masking verification
- Added Robot Framework integration test for end-to-end redaction
- Added ASV benchmarks for redaction throughput on both secrets-present
  and no-secrets content paths

ISSUES CLOSED: #573
2026-03-13 15:35:47 +00:00