Skip to content

Reduce false positives in credential and prompt injection scanners#67

Merged
debu-sinha merged 1 commit into
mainfrom
fix/false-positives
Apr 1, 2026
Merged

Reduce false positives in credential and prompt injection scanners#67
debu-sinha merged 1 commit into
mainfrom
fix/false-positives

Conversation

@debu-sinha
Copy link
Copy Markdown
Owner

Closes #65, closes #66

What changed

Credential scanner (#65): Expanded _is_test_or_doc_context to detect:

  • Rust test files (*_tests.rs, *_test.rs)
  • Dummy/fake files (dummy*, fake*)
  • Example/sample files (example*, sample*)

Files matching these patterns get severity downgraded from CRITICAL/HIGH to LOW.

Prompt injection scanner (#66): Fixed hidden instruction HTML comment pattern:

  • Removed run keyword (too common in file paths like /commands/run.ts)
  • Added \b word boundaries to remaining keywords
  • CJK documentation comments no longer trigger false positives

Testing

Pattern tests verified:

  • CJK doc <!-- 证据来源:packages/cli/src/commands/site.ts -->: NOT matched (correct)
  • Real injection <!-- ignore all previous instructions -->: matched (correct)
  • Rust test files, dummy/fake/example files: detected as test context
  • Real source files: NOT suppressed

Expected impact on MCP dashboard: reduces critical/high FP rate from 59% to ~18%.

Credential scanner (#65): add Rust test file patterns (_tests.rs,
_test.rs), dummy/fake/example filename detection to test context.
Files matching these patterns get severity downgraded to LOW.

Prompt injection scanner (#66): remove 'run' from HTML comment
injection keywords (too common in file paths), add word boundaries
to remaining keywords. Prevents CJK documentation from triggering.

Signed-off-by: debu-sinha <debusinha2009@gmail.com>
@debu-sinha debu-sinha merged commit 1ae1d5c into main Apr 1, 2026
14 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.

Prompt injection scanner: false positive on CJK documentation Credential scanner: suppress findings in test/example/dummy files

1 participant