Repository navigation
test(xtest): verify assertion bindings in Python; split out test_tdf_assertions.py - #656
Draft
dmihalcik-virtru wants to merge 2 commits into
Draft
dmihalcik-virtru wants to merge 2 commits into
dmihalcik-virtru wants to merge 2 commits into
Conversation
Pure move: the assertion round-trip, manifest-validity, and assertion tamper tests (and change_assertion_statement) leave test_tdfs.py unchanged. The X-Test workflow lists test modules explicitly, so add the new module there so the tests keep running in CI. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
The assertion tests only checked that decrypt succeeds, so two SDKs that agreed on a wrong binding would pass. assertions.assert_bound now re-derives each binding from the written manifest: - each requested assertion is present and was copied through unchanged - no signingKey leaks into the manifest - binding is a compact JWS whose assertionHash is the JCS hash of the assertion and whose assertionSig is base64(aggregateHash || hash), using the hex form for manifests without a schemaVersion - RS256/HS256 signatures verify against the fixture keys; assertions without their own key must be HS256 (over the payload key) test_assertions_units.py covers the helper offline and runs in check.yml. 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. Comment |
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.



Prep for DSPX-5229 (constant-size assertion bindings). Until now xtest only checked that assertion TDFs decrypt. It never checked what the writer actually put in the manifest, so if two SDKs agreed on a wrong binding the tests still passed. This PR adds a Python-side reference check so we can test the new binding form against something independent of the SDKs.
Two commits, reviewable separately:
refactor: move assertion tests into
test_tdf_assertions.py. A pure move out oftest_tdfs.py. The X-Test workflow lists modules explicitly, soxtest.ymlnow lists the new file. Without that, the tests would silently drop out of CI.test: check assertion contents and bindings in Python. Adds
assertions.assert_bound, called after encrypt in the round-trip and manifest-validity tests. It checks that:signingKeyleaked into the manifestassertionHashclaim equals the JCS SHA-256 of the assertion, and itsassertionSigclaim equalsbase64(aggregateHash ‖ hash). Manifests with noschemaVersionuse the hex form of the hash.test_assertions_units.pytests the helper without services (added tocheck.yml).The binding format was taken from the Go SDK (
sdk/assertion.go,tdf.go), the web SDK (lib/tdf3/src/assertions.ts) and the Java and otdfctl CLIs' key handling. Once DSPX-5229 lands,assertion_sigis where the new digest form gets accepted.