Repository navigation
feat(sdk): add opt-in hexless policy binding - #4232
Open
pflynn-virtru wants to merge 3 commits into
Open
pflynn-virtru wants to merge 3 commits into
pflynn-virtru wants to merge 3 commits into
Conversation
1 of 3 tasks
|
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. Comment |
Contributor
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
pflynn-virtru
marked this pull request as draft
October 15, 2026 19:44
Contributor
Contributor
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
Contributor
…egacy KAS The spec defines a key access object's policy binding hash as Base64(HMAC). Every SDK writes Base64(hex(HMAC)) instead, and no KAS released before the dual-accept fix can verify the spec's form: older ones always hex-decode it, later ones compare an untrimmed decode buffer. Flipping the writer outright breaks decryption against every deployed KAS. Keep the legacy form as the default and add WithSpecCompliantPolicyBinding (and chunked and experimental/tdf equivalents) to write the spec's form. A pre-4.3.0 target mode overrides it. On read, re-encode a 32-byte binding to the legacy form in the rewrap request. Every KAS verifies that form, so a TDF carrying the spec's binding decrypts through this reader against any KAS. Older readers forward the binding unchanged and still need a KAS with the fix, which is why the default stays legacy until fixed KAS are broadly deployed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.com>
"Spec compliant" depends on which spec version the reader has in mind. Name the option for what it changes instead: it drops the hex layer. WithSpecCompliantPolicyBinding -> WithHexlessPolicyBinding WithChunkedSpecCompliantPolicyBinding -> WithChunkedHexlessPolicyBinding Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.com>
pflynn-virtru
force-pushed
the
fix/policy-binding-sdk-optin
branch
from
October 19, 2026 22:58
938b5a2 to
b7dfbb1
Compare
2 of 3 tasks
pflynn-virtru
marked this pull request as ready for review
October 19, 2026 22:58
This was referenced Oct 19, 2026
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.
Part of #3578. Adds an opt-in hexless policy binding: the spec's
Base64(HMAC)form, without the hex layer of the legacyBase64(hex(HMAC)). The default output is unchanged.Proposed Changes
The spec defines a key access object's policy binding hash as
Base64(HMAC), but the Go SDK writesBase64(hex(HMAC)). KAS releases before #4223 can't verify the spec form, so switching the default would break decryption against every deployed KAS. Instead, this adds an opt-in:WithHexlessPolicyBinding()(CreateTDF),WithChunkedHexlessPolicyBinding()(chunked writer), andWithHexlessPolicyBinding()insdk/experimental/tdfwriteBase64(HMAC). The name describes the encoding rather than claiming compliance with a particular spec version. Without them, output is byte-for-byte the same as today.WithTargetMode/WithChunkedTargetModeoverrides the opt-in and keeps the legacy form.Base64(hex(HMAC))in the rewrap request. Both forms carry the same HMAC, and every KAS verifies the legacy form, so this SDK can decrypt a hexless TDF against any KAS. Other bindings are forwarded unchanged for the KAS to judge.#3597 (now a draft) is the follow-up that makes the spec form the default, once KAS versions with #4223 are broadly deployed.
Checklist
Testing Instructions
cd sdk && go test ./... -race: all packages pass, includingexperimental/tdf.TestCreatePolicyBinding.tdf_test.go,chunked_test.goandexperimental/tdf/writer_test.gocover the default, the opt-in, and the opt-in overridden by a pre-4.3.0 target mode.cd sdk && go test -run TestREADMECodeBlocks: passes.golangci-lint run --new-from-rev=origin/main ./...insdk: 0 issues.Interop: opentdf/tests#648 checks that a KAS accepts a hexless binding by rewriting one into an otherwise normal TDF. It is expected to fail against platform versions without #4223.
Compatibility
🤖 Generated with Claude Code