joserfc 1.7
Last reviewed Oct 12, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3.14149 lines · 5.6K tokens
- joserfc 1.764 lines · 2.6K tokens
Total213 lines · 8.2K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 78
- 79
- 89
- 93
- 95
- 117
- 180
- 201
- 203
- 208
- 209
- 214
- 250
- 257
- 294
- 295
- 307
- 319
- 328
- 338
- 347
- 367
- 379
- 409
- 416
- 426
- 427
- 470
- 502
- 522
- 532
- 611
- 674
- 732
- 759
- 770
- 772
- 776
- 780
- 798
- 807
- 829
- 862
- 916
- 918
- 942
- 1104
- 1284
- 1286
- 1287
- 1289
- 1333
- 1395
Prompt Preview
These rules cover joserfc 1.7 for JWT, JWS, JWE, and JWK operations in Python. When using Authlib for OAuth or OpenID Connect flows, also apply the Authlib prompt for its installed version.
Token verification and claims
- Treat
jwt.decode()as the cryptographic step, then callJWTClaimsRegistry.validate(token.claims)before trusting the result. Decoding does not perform the application's issuer, audience, expiration, or authorization checks. - Use
JWTClaimsRegistry, notBaseClaimsRegistry, for JWT time and registered-claim validation. Declareiss,aud, andexpessential, configure the expected issuer and audience, and require the subject or token identifier when the application's token profile needs them. - Validate that decoded claims are a JSON object with the profile's exact types before registry validation. Require single strings for
iss,sub,jti, andnoncewhen present; allow an audience list only where the profile permits it, and require finite JSON numbers for time claims, excluding booleans. - Keep
allow_blankfalse for identity and authorization claims. Avalueorvaluesconstraint does not require a missing claim unlessessentialis also true; list matching accepts any matching member, so implement a separate all-required-permissions check when the operation needs several permissions. - Keep a live trusted clock and a small explicit
leeway. Do not reuse a fixednowvalue in production; checking thatiatis not in the future does not impose a maximum token age, which the application must enforce separately. - Check the