Publish fallback keys in JWKS for rotation - #6464
Open
lorenzozanee wants to merge 2 commits into
Open
Conversation
The documented three-step rotation relies on FallbackKeyFiles being advertised in /.well-known/jwks.json before promotion. Server construction only read SigningKey, so the JWKS always contained a single key and step 1 had no observable effect. Populate SigningJWKS from PublicKeys, keeping the primary key first and publishing fallbacks as public-only JWKs. Signing still uses only the primary key. This restores the overlap window and fixes the hard-cutover on promotion. Signed-off-by: lorenzozanee <wyz0707@proton.me>
lorenzozanee
requested review from
ChrisJBurns,
JAORMX,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
August 30, 2026 19:36
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6464 +/- ##
=======================================
Coverage 78.02% 78.03%
=======================================
Files 767 767
Lines 74273 74294 +21
=======================================
+ Hits 57955 57977 +22
+ Misses 16313 16312 -1
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The documented three-step rotation relies on FallbackKeyFiles being advertised in /.well-known/jwks.json before promotion. Server construction only read SigningKey, so the JWKS always contained a single key and step 1 had no observable effect. Populate SigningJWKS from PublicKeys, keeping the primary key first and publishing fallbacks as public-only JWKs. Signing still uses only the primary key. This restores the overlap window and fixes the hard-cutover on promotion. Signed-off-by: lorenzozanee <wyz0707@proton.me>
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.
Summary
The three-step zero-downtime rotation documented in
pkg/authserver/server/keys/config.go:31-39depends onFallbackKeyFilesbeing published in/.well-known/jwks.jsonduring step 1, so consumers can verify tokens signed with the new key before it becomes the signer.FileProvidercorrectly loads fallbacks intoallKeysand exposes them viaPublicKeys(), but server construction only calledSigningKey()and builtSigningJWKSwith a single entry.PublicJWKS()therefore always returned one key, step 1 was a no-op, and promotion became a hard cutover that invalidated outstanding JWTs for up tomax-age=3600.SigningJWKSfromKeyProvider.PublicKeys()keeping the primary first; fallbacks are added as public-only JWKsSigningKey()as the sole signing sourceFixes #6451
Type of change
Test plan
task test)task test-e2e)task lint-fix)Verified
pkg/authserver/...unit suite passes. AddedTestNewAuthorizationServerConfig_WithAdditionalKeys(primary-first ordering, public-key stripping, signing isolation) andTestNewServer_JWKSIncludesFallbackKeyswhich starts aFileProviderwith a fallback file and hits/.well-known/jwks.jsonto assert both keys are published.API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.Changes
pkg/authserver/server/provider.goAdditionalKeystoAuthorizationServerParamsand buildSigningJWKSas signing + additionalpkg/authserver/server_impl.goPublicKeys()intoAdditionalKeys(dedup primary, public-only, warn on error)pkg/authserver/server/provider_test.gopkg/authserver/server_test.go/.well-known/jwks.jsonintegration test withFileProviderfallbackDoes this introduce a user-facing change?
Yes.
/.well-known/jwks.jsonand/.well-known/openid-configuration(id_token_signing_alg_values_supported) now correctly advertise fallback keys and their algorithms during rotation, enabling the documented overlap window. No configuration change required.