Repository navigation
feat(git): Add key_id to name a git grant key by its kid - #173
Merged
Merged
Conversation
Consumers that log which key signed a grant, like Seer during a key rotation, had to parse the JWT header with PyJWT to read the kid. The kid is derived from the key, so the library can hand it out directly and keep the derivation in one place. A signer gets its own id with key_id(public_key_of(private_key)) rather than a second, private-key form: the composition is one line and keeps the API to one function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vaind
marked this pull request as ready for review
November 3, 2026 18:36
cmanallen
approved these changes
Nov 3, 2026
3 tasks done
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.
Seer reads a grant's
kidwithjwt.get_unverified_headerjust to log which key signed it (getsentry/seer#9252). This addskey_id(public_key: str) -> str, which returns the kid for an Ed25519 public key in PEM and raisesGitGrantKeyErrorfor a bad key, asverify_grantdoes. A signer callskey_id(public_key_of(private_key)), so there's no separate private-key form.Not included: reporting which key verified a grant. It would need a second verify function or a new tag on every
GitServermetric, and the rotation doesn't need it, since no grant signed with the old key is still valid 15 minutes after Seer switches.Tests check
key_idagainst thekidheader fromsign_grant, and check that bad keys raise without quoting the key.Changelog Entry
key_idto get a git grant key'skidfrom its public key, so callers needn't parse the grant's JWT header🤖 Generated with Claude Code