Repository navigation
fix(jwt): reject repeated names at every depth with Json.unique.keys - #495
Merged
Merged
Conversation
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.
jwt checked repeated member names with its own
dup, which looked only at the top level of the header and claims and compared every pair of names. This switchesparse(header and claims),sign, and each JWK injwks.parsetoJson.unique.parsed, which checks decoded names in every nested object at O(n log n) per object (json 0.6.1.1, #482).dupis deleted.Behaviour change: a token whose claims repeat a name inside a nested object, such as
{"cnf":{"k":1,"k":2}}, now fails withMalformedbefore the signature is checked, andsignof such claims fails withBadClaim. RFC 7515 §5.2 allows rejecting repeated names. A JWK with a repeated name is still skipped on its own, so the rest of the set still loads.Checks:
scripts/check.sh jwtpasses, including theheader_duplaw and two new cases (verify and sign with a nested repeated name). On main, the verify case givesBadSigand the sign case succeeds.jwt/jwks-check.shpasses.jwt goes to
0.7.1.0; no package imports jwt.Closes #494
Refs #481