fix: ECDSA JWK thumbprint uses generator point instead of public key coordinates#421
Open
mesaglio wants to merge 1 commit intocesanta:mainfrom
Open
fix: ECDSA JWK thumbprint uses generator point instead of public key coordinates#421mesaglio wants to merge 1 commit intocesanta:mainfrom
mesaglio wants to merge 1 commit intocesanta:mainfrom
Conversation
getRFC7638Thumbprint was using params.Gx/Gy (the curve's generator point, a constant shared by all keys on the same curve) instead of pubkey.X/Y (the actual public key coordinates). This caused every ECDSA key on P-256 to produce the identical kid, breaking the disable_legacy_key_id feature and making key rotation undetectable for affected deployments.
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.
getRFC7638Thumbprintwas usingparams.Gx/Gy(the curve's generator point, a constant shared by all keys on the same curve) instead ofpubkey.X/Y(the actual public key coordinates).This caused every ECDSA key on P-256 to produce the identical kid, breaking the
disable_legacy_key_idfeature and making key rotation undetectable for affected deployments.To reproduce
Stop the server, update
config.ymlto useecdsa2.crt/ecdsa2.key, restart, and request a new token.Expected result (correct behavior, RFC 7638 compliant):
Each key produces a unique kid derived from its own public coordinates:
key 1 → kid: "GUebkAAx1QFg2mhM0v9rcdvJQPUacaez5c5bzQuf_eM"
key 2 → kid: "ho2fTx0KnTD6wdA8qyAfIxvL27hxCeubWu9suUh6XcI"
Actual result (buggy behavior, before this fix):
Both keys produce the identical kid because params.Gx/params.Gy (the P-256 generator point, a constant shared by all keys on the curve) are used instead of pubkey.X/pubkey.Y:
key 1 → kid: "xx0BcA-wMohw8atYDJOe6peGModklG2wRHBlXHMvl0M"
key 2 → kid: "xx0BcA-wMohw8atYDJOe6peGModklG2wRHBlXHMvl0M" ← identical