TECHNOLOGY

JWKS rotation at an AI gateway: refresh keys without widening trust

In this article
THE QUICK TAKE

Refresh only the trusted issuer’s key source and preserve rejection when no suitable key can verify the token; a key identifier is a selector, not authority.

Diagnose a new key without changing trust

An enterprise gateway rejects otherwise ordinary assistant requests just after its identity provider rotates signing keys. The token names a key identifier absent from the gateway’s cached set. This is a key-distribution problem to investigate, not a reason to accept an unverifiable credential. Separate the issuer whose keys the application already trusts from the untrusted header that asks the verifier to select a key.

Treat the identifier as a selector

RFC 7517 defines kid as a case-sensitive key identifier, including selection within a JWK Set during rollover. It does not define a universal identifier structure. Therefore, an identifier should be interpreted within the trusted issuer’s key context, not as a globally unique authority. A cache indexed only by kid across several issuers can confuse unrelated keys. Record issuer and key-set identity together when explaining a lookup result.

Constrain where refresh obtains keys

RFC 8725 requires verification keys to belong to the claimed issuer and warns about blindly following jku or x5u header URLs. For this gateway, configure the permitted issuer-to-key-source relationship outside the incoming request. A newly observed kid must not choose an arbitrary network destination. Validate the identifier as lookup input, and keep the algorithm policy independent of whichever key happens to be returned.

Bound refresh work under repeated misses

Define the gateway’s behavior when a trusted source is temporarily unreachable or repeatedly returns no matching key. A proposed operating policy can coalesce simultaneous refreshes, limit repeated misses and retain a bounded negative result. These are implementation choices to verify in the selected library, not properties guaranteed by the JWK format. Distinguish a stale cached set, an unsuccessful refresh and a successful refresh that still contains no suitable key. Each requires a different diagnosis without relaxing signature verification.

Rehearse rotation and unknown identifiers

Use a controlled issuer with an old and a replacement signing key. Observe a permitted token before rotation, publication of the replacement key, cache refresh and acceptance through the normal validator. Add a token naming an unknown identifier and a different trusted test issuer reusing the same identifier. Inspect whether issuer separation holds and whether repeated misses remain bounded. Preserve safe key-set revision or retrieval metadata, not bearer-token contents. No gateway test or latency result is reported here; these are integration acceptance checks.

Explain the boundary after recovery

Acceptance requires the intended issuer’s replacement key to verify eligible requests while unknown or unrelated keys remain unable to authorize tool effects. It does not establish resource permission or current account status. Artifact signature trust explains the broader distinction between matching content and trusted authority. Client-history trust addresses why a conversation cannot repair missing authorization evidence. A recovered key cache should restore the existing trust contract, with the actual issuer, refresh outcome and validation stage visible in the incident record.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles