Repository navigation
fix: reject unsupported OKP curves - #29
Merged
Merged
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-01a0eb70-d1e6-71dd-b774-7a79333b11f8 Co-authored-by: Amp <amp@ampcode.com>
Member
|
Thanks @sj26, the strictness itself looks right to me. RFC 8037 requires One concern: this raises at import, so a JWKS that has an Ed25519 key next to an X25519 ( Could we do the check where the keys are actually created instead, so we will not create eddsa keys out of the wrong curve keys A spec with a mixed JWKS would be useful. |
Amp-Thread-ID: https://ampcode.com/threads/T-01a0eb70-d1e6-71dd-b774-7a79333b11f8 Co-authored-by: Amp <amp@ampcode.com>
Contributor
Author
|
Yeah, good ideas! 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.
Description
An Ed25519 JWK relabelled with
crv: "X25519"currently imports as an Ed25519 key and can verify EdDSA tokens. Requirecrv: "Ed25519"when accessing an OKP signing or verification key, including when constructor parameters override a native key's curve.Missing curves,
X25519,Ed448, and wrong-case curve names now raiseJWT::JWKErrorat key access, not import. A mixed JWKS can therefore contain unrelated X25519 or Ed448 entries without preventing verification with the selected Ed25519 key. Valid native keys and public/private JWKs remain supported. Signatures and cryptographic verification are unchanged: this enforces curve metadata, not a demonstrated signature forgery.Regression tests cover mixed-JWKS selection, imported and native keys, curve overrides, and decoding. Validation: 34 examples, 0 failures; RuboCop passed. Also tested against the patched ruby-jwt core.
Checklist