Repository navigation
fix(sdk): DSPX-1561 verify assertion bindings under the assertions specification - #4307
Draft
dmihalcik-virtru wants to merge 1 commit into
Draft
dmihalcik-virtru wants to merge 1 commit into
dmihalcik-virtru wants to merge 1 commit into
Conversation
…ecification Verify each assertion under the ZTDF assertions specification, Sections 5 to 8, with exactly one key: the per-ID key for its exact id, else the default key, else the payload key with HS256. A failure with the selected key is final, and an empty or unusable selected entry, including an HS256 key given as PEM text, fails with configuration-error instead of falling through to the next source. Check the binding's JWS directly rather than through jwt.Parse: compact serialization in strict base64url, no crit header, an alg this SDK supports that equals the selected key's algorithm, and a signature under that key. A jwk or x5c header must hold the selected public key (RFC 7638 thumbprint) and is refused with an HMAC key. A jwk must be well formed for its key type, with minimal RSA integers and exact EC coordinate lengths, and every x5c entry must be padded base64. Claims other than assertionHash and assertionSig are ignored. A missing binding method means jws; STANAG 4778 binding objects, unknown methods, and bindings with both forms or neither fail with their own reasons. Every failure is an ErrAssertionFailure carrying the exact id and a Section 9 reason. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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
DefaultKey, else the payload key with HS256 (spec Section 6.1). A failure with that key is final. An empty or unusable selected key, including an HS256 key given as PEM text, fails withconfiguration-errorinstead of falling through.crypto/rsa,crypto/hmac) rather than throughjwt.Parse: compact serialization in strict base64url, nocrit, a supportedalgequal to the selected key's algorithm, and a signature under that key.jwkorx5cmust hold the selected public key (RFC 7638 thumbprint) and is refused with an HMAC key; malformed embedded keys are rejected.assertionHashandassertionSigare ignored (noexp/nbfchecks).methodmeansjws;jwsandJWSare accepted; STANAG 4778 binding objects and unknown methods areunsupported-binding.ErrAssertionFailurewith the exact id and a Section 9 reason.Stacked on: #4306. Supersedes the
Assertion.Verifychange in #4303; this branch will be rebased once that and #4304 land.Split out of #4301 (draft; the complete change). Cross-SDK counterparts: opentdf/java-sdk#438, opentdf/web-sdk#1141.
Compatibility: a configured default key applies to every assertion without a per-ID key, including payload-key assertions such as Java's
system-metadata, so those files fail when only a default key is configured.Checklist
Testing Instructions
cd sdk && go test ./... -race(sdk/assertion_verify_test.go).test_assertion_verification.py, forced withXT_FORCE_SUPPORTS=assertion_header_key_pinning,assertion_hash_raw.