Skip to content

fix(rules): stop flagging env reads, call expressions and interpolation as hardcoded secrets (#616, #617) - #627

Merged
ajianaz merged 2 commits into
developfrom
fix/secret-false-positives-616-617
Oct 9, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/secret-false-positives-616-617

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

What

Classify the right-hand side of secret-named assignments before reporting a hardcoded secret. The file path is now passed to the hardcoded-secret filter (post_match_filter_for_path; the path-less post_match_filter is test-only), and the LLM cross-check (has_secret_literal) uses the same classifier.

Rules (non_literal_rhs in src/engine/rules/builtin.rs):

  • Quoted RHS is a literal (also b"...", r#"..."#, String::from(".."), "a" + "b"), unless the whole value is a pure reference: "${X}", "$X", "$(cmd)".
  • Unquoted RHS starting with $ or containing ${..}, $(..) or a backtick is interpolation/command substitution: not a secret, in any file.
  • Other unquoted RHS: source code (js/ts/py/rs/go/java/kt/cs/php/rb/sql/...) means an expression (env read, call, member access, identifier): not a secret. Assignment-style files (.env*, .properties, .ini, .cfg, .conf, .toml, shell, yaml, Dockerfile...) means a bare token is the value: still flagged. Unknown path: unchanged.

Why

Env reads, calls and ${VAR} interpolation were reported as hardcoded secrets. Closes the FP groups pinned in KNOWN_GAPS by #615.

Testing

Closes #616
Closes #617

🤖 Generated with Claude Code

…on as hardcoded secrets (#616, #617)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ajianaz
ajianaz merged commit cba52f5 into develop Oct 9, 2026
14 of 15 checks passed
@ajianaz
ajianaz deleted the fix/secret-false-positives-616-617 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

1 participant