Repository navigation
Description
Observed on squirrel v0.0.138; packages/rules/src/security/leaked-secrets.ts is unchanged since on main.
Problem
security/leaked-secrets already has a tier for keys designed to ship to browsers: pattern entries can set publicByDesign: true (for example Stripe pk_live_/pk_test_ and Supabase sb_publishable_), and those are reported as an informational check instead of a leak. Several other keys and tokens that are public by design still land in leaked-secrets-medium ("verify manually"). Each snippet below is a synthetic fixture in an inline <script> or attribute on a local page.
| Fixture | Reported as today |
|---|---|
https://bucket.example.com/f.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA<16 uppercase alnum>%2F20261028%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=... (a presigned URL) |
AWS Access Key ID (medium) |
<div data-netlify-cwv-token="<HS256 JWT with site_id, account_id, deploy_id and iss "netlify">"> |
JSON Web Token (medium); the decoded meta.issuer is already "netlify" |
a consent-management collection-point JWT (HS256, claims iss, sub, iat) in a script |
JSON Web Token (medium) |
{"search_api_key":"<32 hex>","app_id":"ABCDEFGHIJ"} (hosted-search browser key) |
Generic API Key Assignment (medium) |
{typesense:{apiKey:"<32 alnum>",nodes:[{host:"search.example.com"}]}} (search-only key) |
Generic API Key Assignment (medium) |
Reasons: an ASIA id in X-Amz-Credential is a temporary credential id that appears in the URL by design (the secret and token are not in it); the Netlify web-vitals beacon token and consent collection JWTs are read-only client identifiers signed for the browser; search-only keys are meant to be embedded. Browser RUM ingest client tokens (clientToken:"pub...") and RevenueCat web billing public keys (rcb_...) did not fire on the fixtures I tried, so they only need to stay quiet when new detectors land (see #359).
Proposal
Extend the public-by-design tier: (1) skip or downgrade ASIA/AKIA ids found inside an X-Amz-Credential= query parameter; (2) mark JWTs whose decoded issuer is netlify (with the data-netlify-cwv-token attribute) or a known consent/RUM issuer as informational; (3) mark generic assignments whose key name says search (search_api_key, searchKey, search-only) or whose surrounding object is a Typesense/Algolia client config as informational.
Acceptance Criteria
- An
ASIA...id inside anX-Amz-Credential=query parameter is not reported as a leak (informational at most). - A JWT in
data-netlify-cwv-tokenwith decodediss: netlifyis informational, not in the medium/high checks. - Search-only keys (
search_api_key, Typesense search keys) get a hint and stay at medium confidence, because a variable with that name can still hold an admin key; Algolia and Typesense admin keys, and keys under an admin-named variable, still report (at medium); search-named variables only add a hint (amended 2026-11-01, replaces the informational criterion) - A bare
ASIAid outside a presigned URL, and a JWT with an unknown issuer and sensitive claims, are still reported. - Fixture tests cover each row above; the docs page for
security/leaked-secretslists the public-by-design tier.
Activity
fix(rules): public beacon JWTs match only their own claims; privilege…
fix(rules): typesense key must be inside the typesense object; differ…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
fix(rules): public tier needs positive evidence: no name-based search…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
fix(rules): public tier needs positive evidence: no name-based search…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
fix(rules): public tier needs positive evidence: no name-based search…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
nc9 commentedon Nov 1, 2026
Amended acceptance criterion 3 to the shipped behaviour. A search-only key name (
search_api_key, a Typesense search key) gets a hint in the finding but stays at medium confidence, because a variable with that name can still hold an admin key. Algolia and Typesense admin keys still report high. A probe on the stack's second PR confirms an Algolia admin key undersearch_api_keyandsearch_admin_api_key, and TypesenseapiKey/adminApiKey, are all still reported at medium or above.nik
nc9 commentedon Nov 1, 2026
Corrected the amended criterion to what was measured: admin keys under search-named or admin-named variables are reported at medium, not high. The question of reporting admin-named keys at high is tracked in a follow-up issue.
nik
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
feat(rules): leaked-secrets public tier: Shopify platform tokens, bea…
nc9 commentedon Nov 1, 2026
Shipped in v0.0.158 and checked against it: every acceptance criterion is met (an
ASIAid in a presigned URL with its signature and expiry is informational, the Netlify web vitals token is public, search-named keys get a hint and stay at medium, bare ASIA and unknown-issuer sensitive JWTs still report, fixtures and docs). The consent-vendor JWT row stays reported on purpose, and the admin-named key tier is tracked in #1515. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.158nik
feat(rules): admin-tier hint on admin-named search keys, whole-word a…