PyJWT 2
Last reviewed Oct 12, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3.14149 lines · 5.6K tokens
- PyJWT 252 lines · 1.9K tokens
Total201 lines · 7.5K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 78
- 79
- 89
- 93
- 95
- 117
- 180
- 208
- 209
- 214
- 250
- 257
- 294
- 295
- 307
- 319
- 327
- 328
- 338
- 347
- 367
- 379
- 409
- 416
- 426
- 427
- 470
- 502
- 522
- 532
- 611
- 674
- 732
- 759
- 770
- 772
- 776
- 798
- 807
- 829
- 862
- 916
- 918
- 942
- 1104
- 1284
- 1286
- 1287
- 1289
- 1333
- 1395
Prompt Preview
Apply the Python 3.14 prompt first, including its PyJWT verification policy and bounded JWKS retrieval. These rules cover PyJWT 2's JWT and JWS APIs on that baseline. Use a complete OAuth or OpenID Connect implementation for the surrounding protocol.
Verification APIs and options
- Use
jwt.decode()orjwt.decode_complete()for JWT claims.jwt.api_jws.PyJWS.decode()verifies a JWS and returns payload bytes without JWT claim validation. - Set security options through the documented
optionsmapping and supported named arguments. The legacyverifyargument does not enable verification, and unknown keyword arguments can produce a warning rather than enforce the requested control. - Keep each verification profile's instance and options under trusted application control. Do not mutate shared
PyJWT.options, mix diagnostic decoding with an authentication instance, or let request data selectverify_*flags. - Add required subject, issued-at, token ID, and application claims to
options["require"]when the profile needs them. Presence checking does not establish a valid value;subject=alone does not require a missingsub, andverify_jtichecks a present value's type rather than replay state. - Use
strict_aud=Truewith a trusted stringaudiencewhen the protocol permits exactly one audience. Ordinary audience verification accepts a match within a list; do not apply strict mode to a profile that legitimately requires multiple audiences. - Require
iatand check a bounded maximum age in application code when freshness depends on issuance time.