Repository navigation
Conversation
FanWu-ai
marked this pull request as ready for review
October 19, 2026 22:00
This branch has not been deployed
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.
Summary
Valid JSON that is not an object, such as
null,[], or"key", currently causes rawAttributeErrorexceptions in JWK loaders. Applications catching PyJWT's documented key-format errors cannot handle these failures through the usual exception hierarchy.Reject non-object JSON in the four supported algorithm loaders using their existing
InvalidKeyErrorchecks, and inPyJWK.from_json()/PyJWKSet.from_json()usingInvalidKeyError/PyJWKSetError. Keep the high-level checks at the JSON boundaries so that existingfrom_dict()mapping behavior remains unchanged. Known-present EC/OKP coordinate fields use indexed access after the existing membership checks, preserving strict typing.Add 36 regression cases covering arrays, null, booleans, numbers and strings across all six entry points, plus three key-set mapping controls for
dict,UserDictandMappingProxyType. A changelog entry is included. Valid key construction, signature verification and malformed-JSON syntax handling are unchanged.Related work
The endpoint-payload validation introduced in #1208 covers the HTTP JWKS client/cache path. This change covers the public JSON deserialization entry points that still leak
AttributeError.Validation
Based on master
16231abfd1d8eab4953e8779b3017b859c88565e, on Linux:git diff --checkpassed. Independent automated review also checked 72 invalid JSON shapes and four valid key/mapping controls.The lint environment needed writable cache-directory environment variables passed through tox. No project configuration or check was changed. The remaining interpreter/OS matrix has not run locally, and no hosted CI pass is claimed.
AI assistance was used to prepare, test and review this change. No human review is claimed.