Repository navigation
Description
Generic Secret Assignment, Generic API Key Assignment and Generic Token Assignment match on a key name (password, secret, apiKey, token…) and report almost any value next to it. Hand-verifying all 697 unreviewed Generic Secret Assignment flags from a ~38k-site batch (v0.0.141; one GET per source, masked context, nothing used or tested) gave 557 false positives, 66 public-by-design and 63 real. The three biggest false-positive classes have nothing secret-like in the value at all:
| pattern | flags / sites | example shape |
|---|---|---|
| value equals the key name or a label | 130 / 127 | password:"Password", secret:"secret", form field names in react-hook-form or zod schemas |
| i18n dictionaries | 95 / 72 | {password:"Contraseña", apiKey:"Clé API"} in translation bundles |
| code expressions and selectors | 63 / 60 | "a=ice-pwd:"+e.pwd, input[type=password], env.SECRET||"x" |
A single value-plausibility gate removes about 55% of the rule's false positives in this class. The value must:
- be a quoted string literal, not an expression or concatenation fragment
- differ from the key name (case-insensitively, ignoring
_,-and spaces) and not be a plain dictionary word or identifier - contain a digit or symbol, or be 16+ characters
- not sit inside a selector or attribute-match context (
[type=…],:password)
Related: closed #1241 (key-name constants) still fires on v0.0.141 for storage-key values shaped like "*_secret_v6".
Acceptance Criteria
-
Fixtures for each pattern above (form-schema labels, an i18n bundle in 2 languages, an ICE
pwdconcatenation, a[type=password]selector, anenv||"x"fallback) produce noGeneric * Assignmentitem. -
A storage-key constant like
const K="app_secret_v6"produces no item (regression for fix(rules): ignore credential key-name constants #1241). -
Real assignments still report:
SECRET_KEY="<40 hex>",password:"Xk9!…"(12+ mixed),client_secret:"GOCSPX-…"(fixtures). -
The rule docs describe the plausibility gate.
-
A value that is a CSS-module class (
Name_key_hash,-module__), a URL or path (starts withhttp,//or/), a dotted, colon or snake identifier with no digit run, a RequireJS path (/js/), an env-var reference, or ends in.../…or is bullets/empty produces no item (one fixture per class). A bech32secret1…or0xhex address is still reported: a0xvalue of 64 hex is also a private-key shape, so these are not dropped (amended 2026-11-01). (amended 2026-11-01: a css-loader class with a___hashtail is dropped, but aName_key_hashclass such asAuthScreen_password_Yostill reports on purpose, because it reads like a drawn password; a dotted, colon or snake identifier is dropped only when it is all lower case and has a credential word, somail:saveAccountand__ns:keystill report. A RequireJS module path such asMagento_Customer/js/change-email-passwordis still to be dropped: a fix is in progress.) (amended 2026-11-02: a RequireJS/AMD module path is dropped when every word is on the module-path word list; the issue's own examples are, and paths with unlisted words still report as before. A vocabulary of every Magento module word would also suppress passphrases made of those words, and each added word widens a suppression.) -
A match whose captured span contains
;,===or an unbalanced(/)is rejected (fixture from minified code).
Activity
nc9 commentedon Oct 30, 2026
More value classes from the same hand-verified generic-secret lane (v0.0.141, ~38k sites). Each is cheap to reject on the value alone:
{form:"AuthScreen_form_x1",password:"AuthScreen_password_Yo"}forgotPassword:"https://…/forgot-password",password:"/settings/password/"password:"auth_reset_password",secret:"mail:saveAccount","__ns:key"addresses:{secret:"secret1<38>"}(a bech32 address),0x…40-hex addresseschangeEmailPassword:'Magento_Customer/js/change-email-password'this.apiKey…this.baseURL…,apiKey===e.apiKeyKEY: import.meta.env.VITE_…, all-capsSOME_API_KEY"Abc...","••••••••",""Adding criteria.
Name_key_hash,-module__), a URL or path (starts withhttp,//or/), a dotted, colon or snake identifier with no digit run, a RequireJS path (/js/), a bech32secret1…or0x40-hex address, an env-var reference, or ends in.../…or is bullets/empty produces no item (one fixture per class).;,===or an unbalanced(/)is rejected (fixture from minified code).nc9 commentedon Oct 30, 2026
Maintainer decision: a plain word under a password/secret/token-named key (for example
changeme) keeps reporting, because a weak default is a real credential at least as often as a placeholder. The plain-word skip in the acceptance criteria is not implemented; the other classes (labels, i18n, code spans, storage keys, CSS-module classes, credential-free URLs, addresses, env references, masks) are.nik
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): gate keeps shapes that read as drawn values reporting; tw…
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): gate is bounded (256-char cap, per-scan walk allowance); …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
nc9 commentedon Nov 1, 2026
Amended the acceptance criterion on addresses: a bech32
secret1…value and a0xhex value stay reported, because a0xvalue of 64 hex is also a private-key shape and a blockchain address cannot be told from a key by its shape alone. The plausibility gate drops the other listed shapes (CSS-module classes, URLs and paths, dotted, colon and snake identifiers, env-var references, elided or masked values).nik
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
fix(rules): leaked-secrets plausibility gate on generic assignments; …
nc9 commentedon Nov 1, 2026
Amended the identifier criterion to the shipped behaviour. A css-loader class with a
___hashtail is dropped, but aName_key_hashclass (for exampleAuthScreen_password_Yo) still reports on purpose, because it reads like a drawn password. A dotted, colon or snake identifier is dropped only when it is all lower case and contains a credential word, so a colon identifier with a capital (mail:saveAccount,__ns:key) still reports. The other criteria are ticked as met on v0.0.158. That criterion stays open for one shape: a RequireJS module path that does not start with/(Magento_Customer/js/change-email-password) still reports; a fix is in progress.nik
fix(rules): leaked-secrets module path needs listed words, not any lo…
docs(rules): leaked-secrets module path: only all-listed-word paths s…
fix(rules): leaked-secrets treats an AMD/RequireJS module path as a n…
fix(rules): leaked-secrets module path needs listed words, not any lo…
docs(rules): leaked-secrets module path: only all-listed-word paths s…
nc9 commentedon Nov 2, 2026
Checked against v0.0.159 (shipped RequireJS rule: a word list). Met: the plausibility-gate criteria,
app_secret_v6, real assignments, the;/===/unbalanced-paren rule, GermanGeheimnis, and the amended identifier text (mail:saveAccount,__ns:keyandAuthScreen_password_Yostill report on purpose). Open: the value-class criterion for RequireJS paths. The issue's own examples (Magento_Customer/js/change-email-password,changeEmailPassword:'...') no longer report, but the rule drops a path only when every word is on its list: of 15 further real-looking Magento/RequireJS paths underpassword:, 7 dropped and 8 still report (for exampleMagento_Checkout/js/action/set-payment-information,Magento_Customer/js/password-strength-indicator,Magento_Braintree/js/view/payment/adapter). Leaving this open: either extend the word list or amend the criterion to the listed module-path words.nik
nc9 commentedon Nov 2, 2026
Amended the value-class criterion to the shipped behaviour, with the original text kept visible. A RequireJS/AMD module path is dropped when every word is on the module-path word list; the issue's own examples (
Magento_Customer/js/change-email-password,changeEmailPassword:'...') are, and paths with unlisted words still report as before (of 15 further real-looking Magento/RequireJS paths underpassword:, 7 dropped and 8 still report). A vocabulary of every Magento module word would also suppress passphrases made of those words, and each added word widens a suppression, so the list is not extended on speculation: a specific path someone reports is a one-line list edit with a justification. All criteria are now met on v0.0.159. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.159nik