-
Notifications
You must be signed in to change notification settings - Fork 170
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
Validate tree ID on calls to /api/v1/log/entries/retrieve #1017
Conversation
a64668a
to
d0e2a95
Compare
Codecov Report
@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
+ Coverage 41.57% 41.60% +0.02%
==========================================
Files 71 71
Lines 6929 6932 +3
==========================================
+ Hits 2881 2884 +3
- Misses 3746 3747 +1
+ Partials 302 301 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Interesting! Thanks for the fix and debugging. So what was happening before was that we were actually retrieving the result via searchHashes
on the raw uuid
it seems.
So even now, if you send an something where sharding.ValidateEntryID(entryID)
is an error, you will continue to do that behavior and return something from a different tree.
I'm a little brain-fried right now, but I think the fix is going to need to propogate the entire EntryUUID when you go through this case: Lines 346 to 350 in d0e2a95
Then in here: extract the uuid and validate the returned tree ID when one was in the EntryUUID request: Line 396 in d0e2a95
|
Yep, but I think |
Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
I think it'll error out if the tree ID doesn't parse as an int64 or if it's 0 rekor/pkg/sharding/sharding.go Lines 153 to 162 in 5159d01
|
Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
I think it's fine if the tree is 0, since that maps to having a UUID and putting a bunch of 0s in front of it to form an EntryID. To address the failure on parsing int64 I added in a validation for UUID so it should do something like this:
|
That's perfect! Thank you!! That made the fix so clean |
fixes #1014, cc @asraa
Signed-off-by: Priya Wadhwa priya@chainguard.dev