Repository navigation
fix(sdk): DSPX-1561 verify assertion bindings only with the selected key - #4303
Open
dmihalcik-virtru wants to merge 1 commit into
Open
dmihalcik-virtru wants to merge 1 commit into
dmihalcik-virtru wants to merge 1 commit into
Conversation
Assertion.Verify checked a binding against the key the reader selected (the per-ID key, else the default key, else the payload key with HS256) and also against any key carried in the JWS protected header (jwk or the leaf of x5c), using the header's alg. Check it with the selected key and that key's algorithm only. A header key never adds to or replaces it, the header's alg must equal the selected key's, and a binding must have exactly one signature. An assertion signed with a key the reader was not given now fails verification even when the JWS embeds that key. Configure the signer's public key as the assertion's verification key instead. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 9, 2026
Contributor
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
Contributor
|
Contributor
This branch has not been deployed
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.
Proposed Changes
Assertion.Verifychecks a binding with the key the reader selected for that assertion (its per-ID key, elseDefaultKey, else the payload key with HS256, as today) and that key's algorithm only.jwk, or the leaf ofx5c) is no longer added to the keys tried, and the header'salgmust equal the selected key's algorithm. A binding must have exactly one signature.This is the minimal, back-portable form of the key-selection fix. The full Section 5–8 verifier (typed reasons, binding forms, strict JWS parsing, embedded-key matching) follows in #4307 and replaces this code.
Split out of #4301 (draft; the complete change). Cross-SDK counterparts: opentdf/java-sdk#434, opentdf/web-sdk#1137.
Compatibility: an assertion signed with a key the reader was not given now fails verification even when its JWS embeds that key, including when no verification keys are configured (payload-key default). Configure the signer's public key as that assertion's verification key.
Checklist
Testing Instructions
cd sdk && go test ./... -race. New cases inTestVerifyUsesOnlyTheGivenKey(sdk/assertion_test.go);TestVerifyAssertionWithJWKInHeader(sdk/experimental/tdf) now expects an embedded key to be ignored.