Repository navigation
Conversation
…ode to a JWT #1283 Signed-off-by: Nik Cubrilovic <[email protected]>
…decidable parts report #1283 Signed-off-by: Nik Cubrilovic <[email protected]>
…e and unparseable-deep parts report #1283 Signed-off-by: Nik Cubrilovic <[email protected]>
…ic payload; looks through one decoy segment #1283 Signed-off-by: Nik Cubrilovic <[email protected]>
4 tasks done
…der, known limit #1530 #1283 Signed-off-by: Nik Cubrilovic <[email protected]>
Merged
Contributor
Author
|
Landed in v0.0.159 as nik |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1283 (the last open criterion: "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").refineJwtkept a match that did not decode as a generic JWT-shaped string at medium (andsecrets-confidence.test.tspinned it). It now drops only on proof (isNotAJwt): a header or payload within the 8,192-character read bound whoseJSON.parsefailed with a SyntaxError or that parsed to something that is not a plain object. Scanner limits are not proof: a part past 8,192 characters, an empty part and a RangeError (JSON nested too deeply) are undecided and report.Shapes that stop reporting (
JSON Web TokenandSupabase Anon Keypatterns)nullReported (medium generic
JSON Web Token, or the token's own classification)alg(missing,null, number, array, object) over a payload that classifies as specific:service_role, admin scope, Supabase anon and authenticated, Hygraph (management and content), Shopify storefront keep their classification. Tested as 7 payload classes x 6 headers.service_rolepayload padded to 9,000 characters; a 9,000-character header)JSON.parse; a 5,000-deep object within the bound parses and keeps its classification)Dropped with a no-alg header
A no-alg header over a payload that would be a plain generic token (
JSON Web Token, expired,Session Token (JWT)): plain claims,permissions:["*"], wallet and Netlify beacon payloads (the beacon branch needs a stringalg, so they are plain tokens under such a header; the wallet-shaped{typ:"JWT"}case inleaked-secrets-public-tier.test.tsis[]).Decoy segments
One decoy
eyJ<30>.right before a real token: the pattern consumes decoy.header.payload as one match; the real token is now classified from the two parts after the decoy (was a generic or dropped match). Known limit, tracked in #1530: two decoys in a row consume the real payload, and the match is dropped (documented, and pinned by a test).Still reported
Every token with a decodable header and payload (any claims, any header fields,
alg: none, expired tokens asJSON Web Token (expired)at info, admin scope at high), plus the undecided cases above.Tests
secrets-confidence.test.ts: dropped-shape table (both patterns), a keep table for no-algheaders (generic andservice_role), oversize and deep-nesting cases, the RangeError/SyntaxError split, undecided cases (empty, oversize header).leaked-secrets-jwt-shape-1283.test.ts: the same at scan level.leaked-secrets-public-tier.test.ts: the{typ:"JWT"}wallet case reports again (flipped back).Skill change: none.