Skip to content

fix(rules): judge hardcoded-secret false positives on code, not trailing comments or quoted colons - #605

Merged
ajianaz merged 2 commits into
developfrom
fix/secret-filter-comment-603
Oct 9, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/secret-filter-comment-603

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

What

is_false_positive_secret now strips a trailing comment (//, #, --, /*, outside string literals) and only considers a : that is outside string literals before applying the object-shorthand heuristic.

Why

Any line with a comment like // note: fix later or // cora-ignore: <rule> made the filter treat the comment text as an object-shorthand RHS, so real secrets were not flagged (#603). Side effect: lines with a cora-ignore marker never produced a scanner finding.

Testing

New unit tests: secret + trailing comment with : is flagged; : inside a string is flagged; { app_secret: formAppSecret } (with and without a comment) is still a false positive; comment stripping ignores markers inside strings. fmt, clippy -D warnings and the full suite pass (one unrelated pre-existing flaky watch test, filed separately).

Closes #603

🤖 Generated with Claude Code

ajianaz and others added 2 commits October 8, 2026 16:21
@ajianaz
ajianaz merged commit 0a16130 into develop Oct 9, 2026
14 checks passed
@ajianaz
ajianaz deleted the fix/secret-filter-comment-603 branch October 16, 2026 00:43
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.

fix(rules): hardcoded-secret false-positive filter drops real secrets when the line has a trailing comment containing ':'

1 participant