Repository navigation
Description
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 (
sub1234567890,iat1516239022,nameJohn Doe) are not reported (fixture). -
Twitter Bearer Tokenrequires the real shape (AAAAAAAAAAAAAAAAAAAAAfollowed by%2F-or-alnum segments of the right length) and is never matched inside adata: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,paystackcontext), and an embeddable-widget hint fordata-*-keyattributes. A fixture per provider pins the label. -
The rule docs list the provider-specific shapes.
-
A
JSON Web Tokenmatch is reported only when its header decodes to a JSON object with analgfield and its payload decodes to a JSON object; otherwise it's dropped (fixture: aneyJ-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 stringalgis 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
fix(rules): jwt.io sample dropped only when it verifies under a publi…
nc9 commentedon Oct 30, 2026
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.JSON Web Tokenmatch is reported only when its header decodes to a JSON object with analgfield and its payload decodes to a JSON object; otherwise it's dropped (fixture: aneyJ-prefixed non-JSON run with two dots).fix(rules): leaked-secrets allowlists read the matcher's own text: ex…
fix(rules): leaked-secrets allowlists narrowed after review: PEM bodi…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets ignores jwt.io samples, bodiless PEM heade…
fix(rules): leaked-secrets drops a non-decoding JWT only on proof; un…
fix(rules): leaked-secrets JWT drop needs proof; missing alg, oversiz…
fix(rules): leaked-secrets no-alg JWT header drops only a plain gener…
docs(rules): leaked-secrets JWT drop wording: bound on unreadable hea…
fix(rules): leaked-secrets drops a JWT-shaped match that does not dec…
fix(rules): leaked-secrets drops a non-decoding JWT only on proof; un…
fix(rules): leaked-secrets JWT drop needs proof; missing alg, oversiz…
fix(rules): leaked-secrets no-alg JWT header drops only a plain gener…
docs(rules): leaked-secrets JWT drop wording: bound on unreadable hea…
nc9 commentedon Nov 2, 2026
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
algdrops it only when the payload is a plain generic token (aservice_roleor 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, aneyJ-prefixed non-JSON run, and a no-algheader with a generic payload are dropped; a no-algor non-string-algheader with aservice_roleor 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.159nik