Add KeyManager for signing key lifecycle to authserver#3407
Merged
Conversation
0419036 to
c290a63
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3407 +/- ##
==========================================
+ Coverage 64.89% 64.98% +0.09%
==========================================
Files 383 387 +4
Lines 37278 37437 +159
==========================================
+ Hits 24191 24328 +137
- Misses 11201 11224 +23
+ Partials 1886 1885 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tgrunnagle
previously approved these changes
Jan 22, 2026
91fa576 to
2e90016
Compare
tgrunnagle
previously approved these changes
Jan 23, 2026
Introduces a KeyProvider interface with two implementations: FileProvider loads a PEM key from disk (for production), and GeneratingProvider creates an ephemeral key on first access (for development). Configuration is via TOOLHIVE_AUTH_SIGNING_KEY_FILE env var - when set, the key is loaded from that path; when unset, an ephemeral key is generated. At authserver startup, the server will call ConfigFromEnv() and NewProviderFromConfig() to obtain a KeyProvider. In Kubernetes deployments, the signing key is mounted from a Secret and the env var points to the mounted path. The provider's SigningKey() method returns the key for JWT signing, while PublicKeys() provides the JWKS endpoint data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2e90016 to
690b981
Compare
tgrunnagle
approved these changes
Jan 23, 2026
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.
This PR introduces signing key management for the OAuth authorization server, consisting of:
When working on the original MVP of the authserver, having to generate signing keys manually was a complaint I received - production and hardened deployments would mount signing keys generated according to the organization requirements, but in order to just kick the tires in dev mode, it's been inconvenient.
Rather than requiring operators to pre-generate and configure keys, the KeyManager enables automatic key generation with secure defaults (ES256/P-256).
When no signing key is configured, the server generates an ephemeral key on startup—convenient for development while logging a warning about token invalidation on restart.