Skip to content

fix: suppress false positives in sec-hardcoded-url and crypto/hardcoded-secret#369

Merged
ajianaz merged 2 commits into
developfrom
fix/sec-fp-v3
Jul 23, 2026
Merged

fix: suppress false positives in sec-hardcoded-url and crypto/hardcoded-secret#369
ajianaz merged 2 commits into
developfrom
fix/sec-fp-v3

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes false positives in the security scanner and rule engine that were flagging legitimate code patterns as security issues.

Closes #357. Closes #364.

Changes

builtin.rs — Extended post_match_filter

Added is_false_positive_url() and is_false_positive_secret() helper functions with exclusions for:

  • SVG xmlns / xlink:href — Namespace URIs, not network connections
  • Docker internal hostnames (http://redis:6379) — No dots = internal, no TLS needed
  • Loopback addresses (localhost, 127.0.0.1, 0.0.0.0) — Already safe
  • Comments and docstrings (//, #, <!--, ///, triple quotes) — Not executable code
  • Empty string values (= '', = "", = $state('')) — No actual secret
  • Svelte $state() / bind: — UI framework bindings, not credentials
  • Bare variable references — e.g. { app_secret: formAppSecret } — RHS is a variable

security_scanner.rs — Wired post_match_filter into scan loop

Both the builtin rule engine and the security scanner now share the same false-positive suppression logic via post_match_filter().

Tests

  • 14 new unit tests in builtin::tests covering all filter branches
  • 3 new integration tests in security_scanner::tests for end-to-end verification
  • 731 total tests pass, 0 failures

No breaking changes

All existing detections remain intact. The filter only suppresses matches that were previously false positives — it never adds new findings.

ajianaz and others added 2 commits July 23, 2026 20:29
…ed-secret (#357, #364)

- Extend post_match_filter with SVG xmlns, xlink:href, Docker hostnames,
  comments, docstrings, loopback, empty values, Svelte bindings, variable refs
- Wire post_match_filter into security_scanner.rs scan loop
- Add 17 unit + integration tests

Closes #357. Closes #364.
@ajianaz
ajianaz merged commit 7d535d8 into develop Jul 23, 2026
10 checks passed
@ajianaz
ajianaz deleted the fix/sec-fp-v3 branch July 23, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant