-
Notifications
You must be signed in to change notification settings - Fork 109
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
Support delegations in client #137
Support delegations in client #137
Conversation
Thanks, @raphaelgavache! Would you please summarize the changes over the source code, so that we know what to expect while reviewing? |
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.
Thanks Raphael. Here's a first batch of comments. I hope to complete a first pass by tomorrow.
e62e1b0
to
b01e941
Compare
Thanks Ethan, the delegation verifier code is now a lot cleaner! |
Thanks for your review, @ethan-lowman-dd! @raphaelgavache: does this implement a single-pass (i.e., look for only one target at a time) or a multi-pass (i.e., look for multiple targets at once) approach to delegations? |
It's the single-pass one that searches for one target at a time |
Pull Request Test Coverage Report for Build 1046833689
💛 - Coveralls |
As a sanity-check, can we cross-check for correctness against this recursive implementation? |
…n-client Iteration on "Support delegations in client"
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.
See this branch for the proposed changes from today.
* Clarify validation of signing role & metadata type * Add/update comments * Validation happens on both decode & encode * Bubble up an error if MatchesPath is called on an invalid DelegatedRole * Match spec for delegation traversal * Comment in the iterator * Add diamond test case * Revert "Match spec for delegation traversal" This reverts commit 15fee6b. * Rename IsTopLevelRole back to ValidRole to avoid breaking change
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.
first set of comments
* Add back lower case check * Initialize with size and comment * Simplify iterator initialization
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.
second round of comments
Co-authored-by: Ethan Lowman <[email protected]>
* Update name * Rename file to target * Nits * Move verifier in iterator and rename fields
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.
* Update delegations to err on top level role * Add simple cycle test * Remove duplicate check
@raphaelgavache, one more thing: can you check whether you match paths using glob-style matching? Meanwhile, I will read your tests to check for correctness... |
@@ -210,13 +218,17 @@ func (c *Client) update(latestRoot bool) (data.TargetFiles, error) { | |||
|
|||
// If we don't have the root.json, download it, save it in local |
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.
Shouldn't this be the responsibility of the user to download the very first root.json from a secure channel?
Hmm, looks like @mnm678 and @asraa are not maintainers of go-tuf, which is not cool! We should fix this. I'm going to go ahead and merge this in the interesting of unblocking this PR, which has been through extensive review. Thanks again everyone, especially @raphaelgavache! |
Thank you for the reviews! |
* Add delegation client * Add TUF3 php test * Use ioutil for go 1.15 * Add more delegations tests * Cleanups * Check new paths * Add suggestion * Add struct tags * Add tags and remove duplicate types * Formatting * Fix order of asserts (should be want, got) * Clean up DelegatedRole validation * Fix root to top targets delegation * July 14 changes (theupdateframework#4) * Clarify validation of signing role & metadata type * Add/update comments * Validation happens on both decode & encode * Bubble up an error if MatchesPath is called on an invalid DelegatedRole * Match spec for delegation traversal * Comment in the iterator * Add diamond test case * Revert "Match spec for delegation traversal" This reverts commit 15fee6b. * Rename IsTopLevelRole back to ValidRole to avoid breaking change * Update after reviews * Add back lower case check * Initialize with size and comment * Simplify iterator initialization * Revert back to "nodes seen" interpretation of delegation traversal spec (theupdateframework#6) (instead of true cycle detection with "edges seen"). This reverts commit cfbb024. * Update client/delegations.go Co-authored-by: Ethan Lowman <[email protected]> * Update following reviews of 16th of july (theupdateframework#7) * Update name * Rename file to target * Nits * Move verifier in iterator and rename fields * Add tests * Update after 19th july review (theupdateframework#9) * Update delegations to err on top level role * Add simple cycle test * Remove duplicate check * Fix comment * Update comment Co-authored-by: Ethan Lowman <[email protected]> Co-authored-by: Ethan Lowman <[email protected]>
This PR adds the support of delegations in the client
Notable changes
Notes
Add TUF3 php test
, this commit only imports test filesFollow ups
Review walkthrough
1.
data/types.go data/types_test.go
MatchesPath
matches a file to a delegation with the support of Paths and PathHashPrefixes2.
verify/db.go
delegationsVerifier
is added to bypass specific logic dedicated to the 4 top roles3.
client/client.go
4.
client/delegations.go client/delegations_test.go
getTargetFileMeta
implements the delegation search logic