-
Notifications
You must be signed in to change notification settings - Fork 24
fix(sdk): Fix the bug in ResourceLocator serialization logic #2791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @sujankota, 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 addresses a critical bug in the Highlights
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Short string, needs more space, Null bytes fill the empty gap, Data now aligns. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes a bug in the ResourceLocator
serialization logic by adding the necessary padding to identifiers. However, the implementation introduces significant code duplication between the handling of HTTP and HTTPS protocols. I've added comments with suggestions to refactor this to improve maintainability and avoid future inconsistencies. Additionally, it appears that unit tests covering this specific padding logic are missing. I strongly recommend adding tests to verify that identifiers are correctly padded to prevent regressions.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
🤖 I have created a release *beep* *boop* --- ## [0.10.0](sdk/v0.9.0...sdk/v0.10.0) (2025-10-21) ### Features * **policy:** Proto - root certificates by namespace ([#2800](#2800)) ([0edb359](0edb359)) * **policy:** Protos List obligation triggers ([#2803](#2803)) ([b32df81](b32df81)) * **sdk:** Add obligations support. ([#2759](#2759)) ([3cccfd2](3cccfd2)) * **sdk:** Call init if obligations are empty. ([#2825](#2825)) ([14191e4](14191e4)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/lib/ocrypto from 0.6.0 to 0.7.0 in /sdk ([#2810](#2810)) ([1c5cf5f](1c5cf5f)) * **deps:** bump github.com/opentdf/platform/protocol/go from 0.12.0 to 0.13.0 in /sdk ([#2813](#2813)) ([1643ed2](1643ed2)) * **sdk:** Fix the bug in ResourceLocator serialization logic ([#2791](#2791)) ([01329d6](01329d6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Proposed Changes
The
setURLWithIdentifier
function has been updated to correctly pad therl.identifier
field with null bytes (\x00
) to the required length (2, 8, or 32 bytes) before it is written. This ensures that the serialized identifier always matches the length indicated by its protocol flag, allowingreadResourceLocator
to parse it correctly during decryption.This change aligns the HTTPS identifier handling with the existing HTTP identifier padding logic, ensuring consistency and correctness across protocols.
Checklist
Testing Instructions