SECURITY ENGINEERING, IN PRACTICE.ANALYSIS / TECHNICAL NOTES / FIELD NOTES
Packet Notes.

Clear thinking on software,
infrastructure and security.

Technical note

Give each JWT consumer an explicit contract

A valid signature is only one part of accepting a token.

Choose the rules outside the token

RFC 8725 calls for algorithm verification and validation of issuer and audience, with distinct validation rules for different token kinds. A consumer should use its configured policy to constrain verification rather than accepting whatever algorithm the token header requests.

Write the consumer contract beside its configuration: expected issuer, accepted audience, permitted algorithms, trusted key source and token purpose. These are review inputs, not values to discover from an otherwise untrusted claim.

Try the wrong valid token

An original staging exercise uses two legitimate token classes: an API access token and a login identity token. Ask which consumer should accept each, then check that a token valid for one purpose cannot silently stand in for the other. Use the same exercise for two APIs with different audiences.

This test is useful precisely because signature verification can succeed. Record which claim or validation rule rejects the unsuitable token, without retaining the credential itself. Include an expired fixture and a token from an untrusted issuer as separate cases.

Plan key changes deliberately

Our operational recommendation is to document how trusted keys are refreshed and how an unknown key identifier is handled. Avoid letting request volume turn key discovery into unbounded outbound work. Keep a bounded diagnostic for rotation failures that identifies the configured issuer and policy revision. Do not relax issuer, audience or signature checks merely to restore a failing integration.

Source & further reading

IETF RFC 8725 · JWT Best Current Practices ↗