Repository navigation
feat(sdk): add opt-in hexless policy binding - #1097
Draft
pflynn-virtru wants to merge 1 commit into
Draft
pflynn-virtru wants to merge 1 commit into
pflynn-virtru wants to merge 1 commit into
Conversation
Add a hexlessPolicyBinding encrypt option (CreateZTDFOptions, EncryptParams, EncryptConfiguration, and the CLI --hexlessPolicyBinding flag) that writes each key access object's policy binding as Base64(HMAC) instead of Base64(hex(HMAC)). Without the option, and whenever tdfSpecVersion is 4.2.2, the writer output is unchanged. On decrypt, the rewrap request re-encodes a binding that decodes to 32 bytes back to Base64(hex(HMAC)), so a KAS without dual-accept still verifies it. The rewrap request now also forwards the policy binding alg: protobuf-es previously dropped it because the manifest field is alg, not algorithm. KAS ignores the field, and the Go SDK already sends it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.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 |
2 of 3 tasks
|
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.



Summary
Adds an opt-in hexless policy binding: each key access object's policy binding hash is written as
Base64(HMAC), the form the TDF spec defines, instead of the legacyBase64(hex(HMAC)). Default output is unchanged. Mirrors opentdf/platform#4232 (Go).hexlessPolicyBinding: trueonCreateZTDFOptions(alsoEncryptParams), and the CLI flag--hexlessPolicyBinding.tdfSpecVersion: '4.2.2'overrides the opt-in and keeps the legacy form.policyBindingHashhelper. It uses the injectedCryptoService.Base64(hex(HMAC))in the rewrap request, so this SDK can decrypt hexless TDFs against any KAS. Legacy bindings pass through unchanged. Older readers forward the binding unchanged and need a KAS with fix(kas): accept spec-compliant policy bindings platform#4223.alg. protobuf-es previously dropped it because the proto field is namedalgorithm. KAS ignores the field, and the Go SDK already sends it.Part of opentdf/platform#3578.
Testing
cd lib && npm test(mocha, wtr, karma): all passing.npm run lintandmake formatclean.cd cli && bats bin/opentdf.bats: 12/12.lib/tests/server.tsnow rejects a 32-byte (hexless) binding, the way a KAS before fix(kas): accept spec-compliant policy bindings platform#4223 does. So the hexless round-trip tests only pass if the reader re-encodes. Removing the re-encode makes them fail.CryptoServiceis used; every key access object in a two-KAS split gets the hexless binding;tdfSpecVersion: '4.2.2'overrides; ML-KEM and EC wrapping honor the flag.unit/key-access.test.tsis renamed to.spec.tsso the test runners pick it up.🤖 Generated with Claude Code