Skip to content

security/leaked-secrets: jwt.io samples, AAAA base64 runs, path prefix collisions and Paystack-as-Stripe labelling (corpus triage) #1283

Closed

Description

@nc9

False-positive and labelling classes in security/leaked-secrets that #1227 doesn't cover. Found by hand-triaging every high-signal flag from a ~38k-site batch (v0.0.141, up to 200 first-party scripts per site, masked context only, no credential used or tested).

class evidence today
jwt.io sample tokens 9 of 9 JSON Web Token (admin scope) flags were the jwt.io default sample in JWT decoder tools (sub: 1234567890, iat: 1516239022, iss example.com) High-signal, admin scope
AAAA… base64 runs 9 of 9 Twitter Bearer Token flags were base64 image data, font URLs or WASM/Dart tables (long runs of A) High-signal
Prefix collisions in paths and prose neon_* inside image file names (4), sk-<hash>.svg theme icons, key-<hash>.webp (as Mailgun), IBAN examples as DigitalOcean keys (3), step-1…bucket element ids as Cloudflare tokens Various kinds
Provider mislabelling a Paystack live secret (sk_live_ + 40 hex) reported as Stripe Live Key; chat-widget keys (sk_live_ + 48 hex in data-deployment-key/data-api-key) look the same Wrong provider, so triage misroutes it

Acceptance Criteria

  • Tokens whose decoded payload matches the jwt.io default sample family (sub 1234567890, iat 1516239022, name John Doe) are not reported (fixture).

  • Twitter Bearer Token requires the real shape (AAAAAAAAAAAAAAAAAAAAA followed by %2F-or-alnum segments of the right length) and is never matched inside a data: URI or a longer base64 run (fixtures: a base64 PNG and a WOFF URL).

  • Prefix-based patterns require a token boundary: not preceded by /, . or - inside a URL path, and not followed by an image/font extension (fixtures: neon_x.png, sk-abc123.svg, key-abc.webp).

  • sk_live_ keys are labelled by shape and context: Stripe (Stripe lengths, rk_live_), Paystack (sk_live_ + 40 hex, paystack context), and an embeddable-widget hint for data-*-key attributes. A fixture per provider pins the label.

  • The rule docs list the provider-specific shapes.

  • A JSON Web Token match is reported only when its header decodes to a JSON object with an alg field and its payload decodes to a JSON object; otherwise it's dropped (fixture: an eyJ-prefixed non-JSON run with two dots). (amended 2026-11-02: a match is dropped only when it is proven not to be a JWT: its header or payload, within the 8,192-character read bound, does not decode to a JSON object. A header that is a JSON object with no string alg is dropped only when the payload is a plain generic token; any specific classification (service_role, admin scope, Hygraph, anon) is kept. alg: none, a part over 8,192 characters and a single decoy segment before a real token are reported. Two decoy segments in a row drop the real token: known limit, tracked in leaked-secrets: a lone eyJ decoy segment (or two) before a real JWT is consumed with the real header and the match is lost #1530.)

Activity

  1. added
    bug
    on Oct 29, 2026
  2. added theissue type on Oct 29, 2026
  3. added
    size: M
    rules
    security
    on Oct 29, 2026
  4. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    One more cheap JWT check from the hand-verified JWT lane (v0.0.141, ~38k sites): 2 flags were eyJ…-prefixed base64url runs whose segments don't decode to JSON. The pattern only checks shape.

    • A JSON Web Token match is reported only when its header decodes to a JSON object with an alg field and its payload decodes to a JSON object; otherwise it's dropped (fixture: an eyJ-prefixed non-JSON run with two dots).
  5. added 20 commits that reference this issue on Oct 30, 2026
  6. nc9 commented on Nov 2, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.159 and checked against it: every acceptance criterion is met. The last criterion is amended, with the original text kept visible: a JWT-shaped match is dropped only when it is proven not to be one, and a missing or non-string alg drops it only when the payload is a plain generic token (a service_role or admin-scope payload behind such a header is still reported), so that a real credential is not hidden by an odd header. Probes: an undecodable header or payload, an eyJ-prefixed non-JSON run, and a no-alg header with a generic payload are dropped; a no-alg or non-string-alg header with a service_role or admin-scope payload, alg: none, a part over 8,192 characters and a single decoy before a real token are reported; two decoys in a row drop the real token (known limit, #1530). The first criterion is stricter than its wording: the jwt.io sample is dropped only when the payload is exactly the published one and the signature verifies under a published secret; the same claims signed with another secret still report (documented). Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.159

    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

    bugrulessecuritysize: M

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions