You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security/leaked-secrets: generic assignments flag key-name constants whose value is the name itself #1228
Observed on squirrel v0.0.138; packages/rules/src/security/leaked-secrets.ts is unchanged since on main.
Problem
The generic assignment patterns (Generic Secret Assignment, Generic API Key Assignment, Generic Token Assignment) match on the shape <name containing token/secret/key/password>: "<value>" and accept a value that is plainly a storage key or identifier rather than a credential.
Fixture (external script served as app.js, all names made up):
Result: Generic Token Assignment: ACCESS********************ken" is reported (DROPBOX_ACCESS_TOKEN:"dropbox-access-token"). Pairs where the value is the kebab-case or snake_case form of the key name (a localStorage / config key constant) are the clearest case. The same rule family showed more of this on real sites in minified bundles: identifiers used as values (Password:t), error-message enums ({apiKey:"LoadCustomers",message:e.message}) and lookup tables ({"tools-secrets":"mcp-tools"}). Those three did not reproduce with the synthetic fixtures I tried on the released binary, so I am not claiming them here; if a maintainer can reproduce them, add them to the fixture set.
Expected
A generic assignment whose value is (a) the key name with a different case or separators, (b) a lowercase kebab/snake phrase of dictionary words with no digit and low entropy, or (c) an identifier or property access rather than a string literal, is not reported.
Acceptance Criteria
{DROPBOX_ACCESS_TOKEN:"dropbox-access-token"} and {GOOGLE_DRIVE_TOKEN:"google-drive-token"} produce no item.
{apiKey:"LoadCustomers",message:e.message}, {Password:t} and {"tools-secrets":"mcp-tools"} produce no item (fixture tests).
{apiKey:"<32 random alphanumerics>"} and {token:"<40 hex>"} are still reported.
amended 2026-11-02: {apiKey:"<32 random alphanumerics>"} and {access_token:"<40 hex>"} are still reported. A bare token key is not matched by the Generic Token Assignment pattern, which anchors on access_token and auth_token; widening it to a bare token would flag CSRF and pagination tokens.
I can take this. I’ll add the requested negative fixtures for key-name constants, identifier/property-access values, and low-entropy label strings, preserve the random alphanumeric and hex positive controls, and keep the change scoped to the generic-assignment detector. I’ll open a focused PR after the rule suite and relevant type/lint checks pass.
Checked against main (e86767f). Ticked all three criteria; the third is amended (original text stays visible in the body). First release with the fix: v0.0.141 (37fe29f). Probed through the real rule, synthetic inputs: DROPBOX_ACCESS_TOKEN:"dropbox-access-token", GOOGLE_DRIVE_TOKEN:"google-drive-token", {apiKey:"LoadCustomers",message:e.message}, {Password:t} and {"tools-secrets":"mcp-tools"} produce no item; a 32-character alphanumeric apiKey reports Generic API Key Assignment; a 40-hex access_token and accessToken report Generic Token Assignment; a 40-hex bare token key reports nothing, because that pattern anchors on access_token and auth_token, so criterion 3 is amended to access_token. tests/security/leaked-secrets-precision.test.ts passes (23 tests). Closing. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.141
Activity
WilliamK112 commentedon Oct 28, 2026
I can take this. I’ll add the requested negative fixtures for key-name constants, identifier/property-access values, and low-entropy label strings, preserve the random alphanumeric and hex positive controls, and keep the change scoped to the generic-assignment detector. I’ll open a focused PR after the rule suite and relevant type/lint checks pass.
fix(rules): ignore credential key-name constants #1228
nc9 commentedon Nov 2, 2026
Checked against main (e86767f). Ticked all three criteria; the third is amended (original text stays visible in the body). First release with the fix: v0.0.141 (37fe29f). Probed through the real rule, synthetic inputs:
DROPBOX_ACCESS_TOKEN:"dropbox-access-token",GOOGLE_DRIVE_TOKEN:"google-drive-token",{apiKey:"LoadCustomers",message:e.message},{Password:t}and{"tools-secrets":"mcp-tools"}produce no item; a 32-character alphanumericapiKeyreports Generic API Key Assignment; a 40-hexaccess_tokenandaccessTokenreport Generic Token Assignment; a 40-hex baretokenkey reports nothing, because that pattern anchors onaccess_tokenandauth_token, so criterion 3 is amended toaccess_token.tests/security/leaked-secrets-precision.test.tspasses (23 tests). Closing. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.141nik