[OID4VCI] Reject mismatched signature algorithms during SD-JWT verification#51133
Open
forkimenjeckayang wants to merge 2 commits into
Open
[OID4VCI] Reject mismatched signature algorithms during SD-JWT verification#51133forkimenjeckayang wants to merge 2 commits into
forkimenjeckayang wants to merge 2 commits into
Conversation
Signed-off-by: forkimenjeckayang <forkimenjeckayang@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds algorithm binding to SD-JWT signature verification, preventing JOSE header policy bypasses described in #51109.
Changes:
- Rejects missing or mismatched JWS/verifier algorithms.
- Adds issuer-signed and key-binding JWT mismatch tests.
- Adds a test signer wrapper for reporting alternate algorithms.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
core/src/main/java/org/keycloak/sdjwt/JwsToken.java |
Enforces signature algorithm equality. |
core/src/test/java/org/keycloak/sdjwt/TestSettings.java |
Adds mismatch test support. |
core/src/test/java/org/keycloak/sdjwt/SdJwtVerificationTest.java |
Tests issuer JWT mismatches. |
core/src/test/java/org/keycloak/sdjwt/sdjwtvp/SdJwtVPVerificationTest.java |
Tests key-binding JWT mismatches. |
Signed-off-by: forkimenjeckayang <forkimenjeckayang@gmail.com>
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
SD-JWT signature verification now requires the algorithm declared in the protected JWS
algheader to match the algorithm used by theSignatureVerifierContext.The check is implemented in the shared
JwsToken.verifySignaturepath, so it applies to both:Missing algorithms and algorithm mismatches are rejected before the cryptographic verification operation is invoked. This also prevents profile-level algorithm policies from being bypassed: when a profile accepts the JOSE header algorithm, the verifier context is now guaranteed to use that same algorithm.
Closes #51109