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
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
The JSON Web Token pattern is eyJ<10+>.eyJ<10+>.<10+>. When one eyJ… segment (a decoy: any 30-character eyJ run followed by a dot) sits directly before a real token, the match is decoy.header.payload: the real header is taken as the second part and the real payload as the signature, and the real signature is left behind. The match then does not decode, so it is dropped (or, before #1283, reported as a generic JWT-shaped string instead of the token's own classification). A real service_role token placed after one decoy is lost or misclassified. With two decoys in a row (decoy.decoy.<real header>) the real payload is not in the match at all.
Repro shape (build the values from parts in a test, no real token): var t="eyJ<30 letters>.<base64url header with alg>.<base64url payload with role service_role>.<signature>";
State: pub PR #1528 classifies the real token from the two parts after a single decoy (it reports as the token's own type); two or more decoys in a row are still lost, pinned by a test as a known limit.
Fix direction: after a match that does not decode, re-scan from the character after its first dot so the real token is matched whole; keep the scan linear (the pattern already guards against eyJeyJeyJ… quadratic runs).
Acceptance Criteria
one decoy eyJ… segment directly before a real JWT: the real token is reported with its own classification and the whole real token is the value
two or more decoys in a row before a real JWT: the real token is reported the same way
a run of eyJ segments with no real token still reports nothing, and a 100,000-character run of eyJ. repeated stays linear (timed test)
docs and CHANGELOG no longer list the two-decoy case as a known limit
Acceptance check against main 8d22fa2 (fix shipped in v0.0.163):
#
Criterion
Result
Evidence
1
One decoy before a real JWT: real token reported with its own classification, whole token is the value
PASS
leaked-secrets.tsscanInto JWT retry (sticky regex, jwtMatchIsSuspect in secrets/confidence.ts); packages/rules/tests/security/leaked-secrets-jwt-shape-1283.test.ts "one decoy: the whole real token is the value, with its own classification" asserts type Supabase Service Role JWT and value === real.
2
Two or more decoys in a row: real token reported the same way
PASS
Same file, "two, three and many decoys in a row" (2, 3, 5, 20), "999 decoys in a row", plus crafted valid-JSON decoys and six mixed alg/no-alg orders. The retry is capped at 1,000 steps a page; past it the page is counted as not fully read (omitted > 0, tested) and the CHANGELOG and docs say so.
3
A run of eyJ segments with no real token reports nothing; 100,000-character eyJ. run stays linear (timed)
PASS
"a run of eyJ segments that do not decode, with no real token, reports nothing" and "a run of eyJ segments stays linear" ("eyJ.".repeat(25_000) is 100,000 characters, under 2,000 ms, plus a doubling-ratio check and a 10 MB case under 1,000 ms).
4
Docs and CHANGELOG no longer list the two-decoy case as a known limit
PASS
docs/rules/security/leaked-secrets.mdx says "one or any number in a row, are looked through"; the CHANGELOG entry for this fix describes the old two-decoy loss as the bug and lists only the 1,000-step cap. No remaining "known limit" wording for it.
Ran: bun test tests/security/leaked-secrets-jwt-shape-1283.test.ts in packages/rules: 16 pass, 0 fail.
Activity
docs(rules): leaked-secrets JWT drop wording: bound on unreadable hea…
docs(rules): leaked-secrets JWT drop wording: bound on unreadable hea…
fix(rules): leaked-secrets finds a real JWT behind any number of deco…
fix(rules): leaked-secrets decoy retry: eyJ signature is suspect, cap…
nc9 commentedon Nov 4, 2026
Acceptance check against main 8d22fa2 (fix shipped in v0.0.163):
leaked-secrets.tsscanIntoJWT retry (sticky regex,jwtMatchIsSuspectinsecrets/confidence.ts);packages/rules/tests/security/leaked-secrets-jwt-shape-1283.test.ts"one decoy: the whole real token is the value, with its own classification" asserts typeSupabase Service Role JWTandvalue === real.omitted > 0, tested) and the CHANGELOG and docs say so.eyJsegments with no real token reports nothing; 100,000-charactereyJ.run stays linear (timed)"eyJ.".repeat(25_000)is 100,000 characters, under 2,000 ms, plus a doubling-ratio check and a 10 MB case under 1,000 ms).docs/rules/security/leaked-secrets.mdxsays "one or any number in a row, are looked through"; the CHANGELOG entry for this fix describes the old two-decoy loss as the bug and lists only the 1,000-step cap. No remaining "known limit" wording for it.Ran:
bun test tests/security/leaked-secrets-jwt-shape-1283.test.tsinpackages/rules: 16 pass, 0 fail.nik