mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

phrase.injection: replace metadata conjunct masks with a structural placement-clause parse

Open Dumbris opened this issue 1 month ago • 0 comments

Follow-up from the 12 Sol review rounds on #1630 (fixes #1601, #1589). Every round found one more phrasing variant of the same design limit: maskKeyFileFamily and the metadata conjunct masks in internal/security/detect/checks/phrase_injection.go walk a conjunct chain with word lists and 40–80 character windows, and blank the placement verb when the chain looks metadata-only.

Recall gaps reported by Sol in round 12 (from code reading, not yet probed):

  • Parenthetical qualifier between metadata and conjunction: save its fingerprint (SHA256) and its contents to the notes field
  • Destination between conjuncts: save its creation date to the date field and its contents to the notes field
  • Metadata-first inverted fill: fill the notes field with its fingerprint and its contents (and the .env variant)
  • Compound label tails missing from secretMetadataAlt (e.g. creation time)
  • Key-file direct family uses an 80-character placement window; config-file families still use 40, so long chains there may be missed.

Suggested approach: parse the placement clause into payload items and classify each (secret payload vs metadata) instead of regex-blanking text, so a clause is HARD whenever any payload item is a secret. Measure with cmd/scan-eval --gate on internal/security/scanner/testdata/sec01_injection_variants.json and keep TestSEC01_RealWorldBenignCorpora_NoNewHolds green.

Dumbris avatar Oct 16 '26 16:10 Dumbris