[LOW] Reject incompatible verification key algorithms - #23
Open
OskarEichler wants to merge 1 commit into
Open
Conversation
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
Reject verification keys from a different algorithm family during assignment. This keeps attacker-controlled key/algorithm mismatches inside the gem’s
VerifyKeyErrorboundary instead of allowing later backend method failures.RSA keys are validated by their public components, and EdDSA keys by their Ed25519 verification-key type. ECDSA already validates its algorithm family and curve.
Reproduction
The shared capability-only check accepts an ECDSA key for RSA because it responds to
verify; RSA-PSS later raisesNoMethodErrorforverify_pss. EdDSA similarly accepts RSA keys and fails later on its two-argument verification call. Credential formats that carry both algorithm identifiers and public keys can expose these mismatches to untrusted input.Verification
VerifyKeyErroron this branchCompatibility and breaking changes
Valid keys are unchanged. Incompatible keys now fail at assignment with
VerifyKeyError; callers relying on a later backend-specific exception will observe this intentional error-timing change.