Skip to content

security/leaked-secrets: extend the public-by-design tier (presigned-URL AWS credential ids, beacon JWTs, search-only keys) #1229

Closed

Description

@nc9

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 an X-Amz-Credential= query parameter is not reported as a leak (informational at most).
  • A JWT in data-netlify-cwv-token with decoded iss: netlify is 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 ASIA id 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-secrets lists the public-by-design tier.

Activity

  1. added
    enhancement
    size: M
    rules
    security
    on Oct 28, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    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 under search_api_key and search_admin_api_key, and Typesense apiKey/adminApiKey, are all still reported at medium or above.

    nik

  4. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    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

  5. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.158 and checked against it: every acceptance criterion is met (an ASIA id 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.158

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrulessecuritysize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions