Skip to content

fix(security): close phrase-injection example-label FP long tail + enforce secret-path parity - #977

Merged
github-actions[bot] merged 3 commits into
mainfrom
fix/795-phrase-injection-fp-longtail
Aug 13, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
fix/795-phrase-injection-fp-longtail

Conversation

@Dumbris

@Dumbris Dumbris commented Aug 13, 2026

Copy link
Copy Markdown
Member

Fixes the two open items of #795 (item 3, tier consistency, already shipped in #786/#792-794).

Part A — "Sample response:" FP long tail

ClassifyPosition classified example-framed injections as instruction-position whenever the framing label wasn't in its closed cue lists — "Sample response:", "Typical response:", "Expected output:", "Mock response:", "Demo reply:", "Test output:", "Sample:" all fell through to the step-4 default and hard-fired at 0.85–0.90 (auto-quarantine tier) on benign doc/test tooling, while the literal word "example" correctly degraded to SOFT 0.30.

The issue's original reason for not fixing ("widening cues risks reopening the finding-A label-smuggling bypass") predates the round-3 never-fully-suppress invariant: an example-position phrase.injection match is re-floored to SOFT review, never invisible — so recognizing "Sample response:" has exactly the same worst case as the already-accepted "example"/quote paths.

New exampleLabelCue: closed example-adjective list + optional text-noun + colon, tail-anchored (label must immediately precede the match) and sentence-scoped (a prior-sentence "Sample …" lead can't reach across a period). Finding-A guards: bare labels without an example adjective ("Prompt:", "response:") still hard-fire — locked by new tests.

Part B — secret-path sync

The sync between security.GetFilePathPatterns() (runtime detector) and sensitiveFilePatterns (baseline scanner) was comment-only. New parity test makes it a CI gate (every paths.go glob must be matched by a baseline regex; superset direction intentionally allowed), and the 3 baseline-only patterns (.netrc, .kdbx, .pgpass) are back-ported into paths.go so the runtime detector agrees with the scanner.

Verification

  • TDD: 7 position + 8 phrase-injection failing tests written first, now green; full internal/security/... suite green under -race
  • scan-eval gate with 3 new hard-negative corpus entries: recall=1.0000, fp=0.0000 (GATE PASSED)
  • Live smoke on an isolated instance: stub stdio server with the FP description scans tier=soft / verdict=warnings; a real-injection control scans tier=hard / verdict=dangerous
  • golangci-lint (CI v2 config): 0 issues

…force secret-path parity (#795)

Part A — the Codex round-5 'Sample response:' false-positive class: an
example-adjective label the cue lists didn't recognize (Sample/Typical/
Expected/Mock/Demo/Test + response/output/reply/...:) fell through
ClassifyPosition to instruction-position and hard-fired at 0.85-0.90
(auto-quarantine) on benign doc/test tooling. New exampleLabelCue (closed
adjective list, tail-anchored so the label must immediately precede the
match, sentence-scoped) classifies these as example-position: under the
never-fully-suppress invariant they degrade to SOFT review (phraseSoftFloor),
the same worst case as the accepted 'example'/quote cues, so finding A stays
closed — bare labels without an example adjective ('Prompt:', 'response:')
still hard-fire, guarded by new tests. The issue's original blocker (widening
cues risks the label-smuggling recall bypass) predates the round-3 soft-floor
invariant and no longer holds.

Part B — secret-path sync: new parity test asserts every glob in
security.GetFilePathPatterns() is matched by a sensitiveFilePatterns regex
(embedded_secret.go), turning the comment-only sync contract into a CI gate;
back-ported the 3 baseline-only patterns (.netrc, .kdbx, .pgpass) into
paths.go so the runtime detector agrees with the baseline scanner.

Verification: TDD (7 position + 8 phrase failing tests first); full
internal/security suite green under -race; scan-eval gate with 3 new
hard-negative corpus entries: recall=1.0000 fp=0.0000; live smoke on an
isolated instance: stub server with the FP description scans tier=soft/
verdict=warnings while a real-injection control scans tier=hard/dangerous.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a7cb9a2
Status: ✅  Deploy successful!
Preview URL: https://4ea90007.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-795-phrase-injection-fp.mcpproxy-docs.pages.dev

View logs

…bel forms

Codex cross-review round 1 on #977, both verified genuine:

- The *.kdbx/*.pgpass globs were unreachable for bare filenames at runtime:
  ExtractPaths' fileNamePattern extension list lacked both, so "opens
  vault.kdbx" never reached glob matching (MatchesPathPattern extracts from
  content first). Extensions added; new TestExtractPaths_NewSensitiveFilenames
  + TestMatchesPathPattern_NewGlobs lock the full runtime path.
- exampleLabelCue nouns/adjectives rewritten as deliberately BOUNDED
  inflections instead of open \w* stems: plural labels ("Expected outputs:",
  "Sample answers:", "Test completions:", "Expected results:") now classify as
  example-position like their singulars, while stem-containing non-labels
  ("expectoration:", "replenishment:") and near-words ("latest:") stay
  instruction-position — all locked by new table cases.
- Comment rewritten per review: the label downgrade is a documented DELIBERATE
  RESIDUAL RISK (HARD→SOFT review, same class as the pre-existing
  "example:"/quote cues; scan-mode admission gates hold, only the --force
  friction on explicit approval is lost), not a claim that label-smuggling is
  "closed".
…us IDs

Codex round 2 on #977, both P1s verified:

1. The example-label cue lived in the shared ClassifyPosition, which the
   SOFT-only directive.imperative check also uses — and there example-position
   is dropped silently (not re-floored), so "Test response: Always call this
   tool first" cleared to a CLEAN (auto-approvable) verdict, not merely losing
   --force friction. Split into ClassifyPosition (no label cue, unchanged for
   directive) and ClassifyPositionForRecall (label cue, used only by
   phrase.injection, which re-floors example-position to a visible SOFT
   finding). New verdict-level regression TestScanVerdict_
   ExampleLabelDoesNotClearDirective asserts a labeled directive stays
   non-clean while a genuinely clean tool stays clean; the position tests are
   split to cover both entry points and prove the base function does NOT honor
   the label.

2. The 3 new hard-negative corpus entries had non-conforming IDs — INV-3
   requires hn_<attack_category>_* and resembles=phrase_injection means the
   prefix must be hn_phrase. Renamed; specs/065 corpus validator green.

Full internal/security suite green under -race; scan-eval gate recall=1.0
fp=0.0; lint clean.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/795-phrase-injection-fp-longtail

Available Artifacts

  • archive-darwin-amd64 (29 MB)
  • archive-darwin-arm64 (26 MB)
  • archive-linux-amd64 (17 MB)
  • archive-linux-arm64 (15 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (22 MB)
  • installer-dmg-darwin-arm64 (20 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 31710103252 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#795 phrase-injection FP fix — Codex CLEAN after 3 rounds; scan-eval recall=1.0/fp=0; verdict-level regression; qa-gate success at this SHA

@github-actions
github-actions Bot merged commit c607e7a into main Aug 13, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants