Repository navigation
fix(rules): close secret-detection edge cases (#625, #628, #629, #630) - #636
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
new String,String::from,Some,Secret::new/from,Cow::Owned/Borrowed,Box/Arc/Rc::from, Pythonstr/bytes) counts as a literal; the scanner regex also matches short-callee constructors. Plain calls stay quiet.os.environ.get/os.getenv, JSprocess.env.X || / ??, Rustenv::var(..).unwrap_or(..)/unwrap_or_else, RubyENV.fetch, PHPgetenv() ?:). The env var name is never inspected; empty and${..}defaults stay quiet.${VAR:-literal}/${VAR:=literal}with a secret-looking default is flagged (also quoted, and in YAML values);${VAR},${VAR:-},${VAR:?msg}, nested references, paths, URLs and bare keywords stay quiet.{ password: hunter2hunter2 }is flagged (.yaml/.ymlonly); (3) unspacedpassword:=os.Getenv("X")no longer matches via[=:]; (4) SQLPASSWORD "..."/IDENTIFIED BY "..."detected, with placeholder suppression kept.has_secret_literal) uses the same classifiers.Why
Closes the false negatives and false positives pinned as KNOWN_GAPS rows after #621/#627. The all-alphabetic YAML value (
password: correcthorsebattery) cannot be told apart from references (secret: kubernetes) without a classifier, so it stays a KNOWN_GAP, tracked in #635.Testing
secret: Secret1Typeflipped to unflagged, about 70 positive and negative rows added; one KNOWN_GAPS row remains (fix(rules): all-alphabetic unquoted YAML secret (password: correcthorsebattery) is not flagged #635).cargo fmt,cargo clippy --all-targets -- -D warnings, fullcargo test3x green.cora review --staged --format compact.Closes #628
Closes #629
Closes #630
Refs #625
🤖 Generated with Claude Code