Treat a missing notes reference as a commit without attestations - #199
Merged
Merged
Conversation
Reading attestations from a repository that has no refs/notes/commits yet failed instead of returning none, so the first attestation of a repository could never be written: producing it required reading the attestations that would have created the reference. vcslocator v0.5.0 reports a missing reference with ErrRefNotFound and its error lists can be unwrapped, so replace the string matching in extractCommitBundle with typed checks: no attestations when every failed locator is either the missing reference or a missing note file, an error otherwise. This also covers a nil error with empty note files, which used to panic. Use go-git's typed error for the same check in the storer's own fetch of the notes reference. Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: puerco The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Reading attestations from a repository that has no refs/notes/commits yet failed instead of returning none, so the first attestation of a repository could never be written: producing it required reading the attestations that would have created the reference.
vcslocator v0.5.0 reports a missing reference with ErrRefNotFound and its error lists can be unwrapped, so replace the string matching in extractCommitBundle with typed checks: no attestations when every failed locator is either the missing reference or a missing note file, an error otherwise. This also covers a nil error with empty note files, which used to panic. Use go-git's typed error for the same check in the storer's own fetch of the notes reference.
Thanks to @arpitjain099 for the initial fix in slsa-framework/source-tool#443 and to @CarlAllenn fot the initial bug report in slsa-framework/source-tool#435