Conversation
APWHY
force-pushed
the
jwks-reload-on-unknown-kid
branch
2 times, most recently
from
August 25, 2026 15:31
37eb0e8 to
8afa09b
Compare
APWHY
force-pushed
the
jwks-reload-on-unknown-kid
branch
from
September 7, 2026 11:08
c450413 to
afa67d5
Compare
Adds a refresh mechanism to the cached JWK Set if an unknown key id is recieved. An additional fix has been added to getKeysFromJWKsURI so it rejects non 2xx/3xx codes and returns an error.
APWHY
force-pushed
the
jwks-reload-on-unknown-kid
branch
from
September 7, 2026 11:11
afa67d5 to
b94f7bd
Compare
APWHY
marked this pull request as ready for review
September 7, 2026 11:11
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.
step-caonly refetches the JWKS from the issuer once the cached set has expired (which comes from the JWKS endpoint'sCache-Control: max-age). This means if the issuer rotates keys all future requests through the affected provisioners will fail until the cache expires naturally.This PR adds a refresh mechanism that runs at most once every minute if there is an unfamiliar received
kid, following the recommendation at: https://openid.net/specs/openid-connect-core-1_0.html#RotateSigKeys . Concurrent reload requests are grouped as well.go-oidchas done something similar where they've completely removed theCache-controlchecks entirely, but I wanted to minimise the changes this PR made so I've left them in for now.An additional fix has been added to
getKeysFromJWKsURIso it rejects non 2xx/3xx codes and returns an error. Previously, if the error had a decodeable JSON body it would attempt to do so and empty the keystore (and error out otherwise). It's not entirely related and I can split this out into a separate PR if needed.