Repository navigation
fix(sdk): DSPX-1561 hash assertions as received - #4306
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
Keep the raw JSON of each decoded assertion and compute assertionHash over it, minus only the top-level binding (ZTDF assertions specification, Section 4), instead of re-marshalling the typed struct. Members the SDK does not model are now covered, and an object-valued statement value is hashed as an object. ComputeAssertionHash exposes the calculation for one raw assertion, applying the Section 3 parsing rules first, and sdk/experimental/tdf re-exports it. Update gowebpki/jcs to v1.0.2, whose canonicalization is O(n log n) in members and linear in size, since the hashed object now comes from the file. Writers hash the wire object they write, and refuse with ErrInvalidAssertion an assertion that readers would reject: an empty id, or JSON that breaks Section 3. The id and binding members are decoded leniently, so that a manifest whose assertion has a non-string id or a malformed binding still loads when verification is disabled, and verification reports it. 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
binding(ZTDF assertions specification, Section 4), instead of a re-marshalled copy of the typed struct. Members the SDK doesn't model are now covered, and an object-valuedstatement.valueis hashed as an object.ComputeAssertionHash(wire []byte)returns the hash for one raw assertion, applying the Section 3 parsing rules first;sdk/experimental/tdfre-exports it.ErrInvalidAssertion(a configuration error, not a tamper error) an assertion that readers would reject: an empty id, or JSON that breaks Section 3.idandbindingare decoded leniently, so a manifest with a non-string id still loads with verification disabled; verification reports it.github.com/gowebpki/jcsv1.0.1 → v1.0.2 (canonicalization is O(n log n) in members and linear in size, which matters now that the input comes from the file); bringstestifyv1.12.1.Stacked on: #4305.
Split out of #4301 (draft; the complete change). Cross-SDK counterparts: opentdf/java-sdk#437, opentdf/web-sdk#1140.
Compatibility: assertions are verified against the hash of their stored form. A file whose writer hashed a different form (for example, one that dropped members it didn't model) fails verification.
Checklist
Testing Instructions
cd sdk && go test ./... -race(hash cases insdk/assertion_parse_test.go, including the spec Section 4.4 worked examples and a scaling check);cd otdfctl && go test ./....