fix(tdf): align policy binding encoding with spec, keep legacy compat#3597
fix(tdf): align policy binding encoding with spec, keep legacy compat#3597biscoe916 wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the TDF policy binding encoding to comply with the latest specification while maintaining backward compatibility for archival TDFs. By introducing a shared decoding helper, the KAS service can now transparently handle both raw and hex-encoded HMAC bindings. Additionally, the changes include necessary adjustments to the SDK configuration and internal rewrap verification logic to ensure robust and consistent behavior across different TDF versions. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Old bindings held in hex and base, New standards take a cleaner space. With dual support for past and new, The TDF remains in view. Footnotes
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
Fixes 3578
Proposed Changes
sdk/tdf.goon the existingtdfConfig.useHexflag. Default (spec >= 4.3.0)emits
Base64(HMAC)per spec;WithTargetMode("<4.3.0")keeps legacyBase64(hex(HMAC))forbyte-identical compatibility
decodePolicyBindinghelper inservice/kas/access/rewrap.go. Length-detects the encoding(32 bytes raw vs 64 bytes hex after base64 decode) so KAS dual-accepts both formats — no manifest version
trust needed
dek.VerifyBindingChecklist
Testing Instructions
Automated:
go test ./sdk/... ./service/kas/...— round-trip tests cover both encodings;TestDecodePolicyBindingcovers raw/hex/invalid base64
golangci-lint run ./sdk/... ./service/kas/...Manual interop check (recommended before rollout):
should succeed
WithTargetMode("4.2.2")(legacy hex binding) and rewrap against this branch's KAS —should succeed
Rollout Notes
will reject raw bindings — those operators need to upgrade before SDK writers in their fleet default to raw,
or pin SDKs to
WithTargetMode("<4.3.0")until they doBase64(hex(HMAC))as deprecated-but-MUST-accept so third-party KAS implementationsdon't break on archival TDFs