Repository navigation
fix(rules): detect Go short declarations, YAML/JSON keys and SQL PASSWORD literals (#618, #619, #620) - #621
Merged
Conversation
…nline JSON) (#619) Found when reviewing a one-line JSON object with the real binary: the placeholder check was line-anchored, so {"password": "${X}"} was flagged by sec-hardcoded-secret. All quoted secret pairs on the line must be placeholders. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
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
Three hardcoded-secret false negatives pinned in
KNOWN_GAPSare fixed and their rows moved intoCASES:password := "..."(with or without a trailing comment) andvar apiKey string = "...".password: hunter2hunter2and quoted keys"password": "...","apiKey": "...".CREATE USER app WITH PASSWORD '<literal>'andIDENTIFIED BY '<literal>'.Changes:
crypto/hardcoded-secretregex (optional quote after the key,:=only before a quoted literal, colon-free type before=, SQLPASSWORD '...');sec-hardcoded-secretpattern is now built by one sharedsecret_literal_pattern()that the LLM cross-check (apply_llm_secret_fp_filter) also uses viahas_secret_literal, so LLM findings on the new shapes are not dropped;is_false_positive_secretgains YAML plain-scalar, quoted-placeholder and SQL-placeholder handling.YAML rule (conservative): a whole-line
key: valuewhose key ends in a secret word is flagged only if the value is one token of at least 8 chars containing a digit or symbol, and is not$.../${...}, a tag/anchor/alias, a path, a keyword (true/null/...). Bare alphabetic words (required,formPassword) stay references.Why
Precision and recall both matter for secret detection; these shapes were silently missed. #616/#617 (env-var and interpolation false positives) are out of scope and their rows are unchanged.
Testing
password: ${DB_PASSWORD},!secret db,null,~,required,*alias,&anchor,password_file: /run/secrets/x,"password": "","password": "${X}","password": "{{ x }}", SQLPASSWORD '%s'/'$1'/':pw'/'{pw}'/''/NULL, Go""andos.Getenvforms, etc. No existing row changed.-D warnings, fullcargo testx3 green.cora scanandcora review --stagedon sample Go/YAML/JSON/SQL files with an unreachable LLM report the expected lines and none of the negatives.Closes #618
Closes #619
Closes #620
🤖 Generated with Claude Code