Skip to content

Treat a missing notes reference as a commit without attestations - #199

Merged
miniprow[bot] merged 1 commit into
carabiner-dev:mainfrom
puerco:catch-notes-ref-error
Sep 2, 2026
Merged

Treat a missing notes reference as a commit without attestations#199
miniprow[bot] merged 1 commit into
carabiner-dev:mainfrom
puerco:catch-notes-ref-error

Conversation

@puerco

@puerco puerco commented Sep 2, 2026

Copy link
Copy Markdown
Member

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

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>
@puerco puerco added the bug Something isn't working label Sep 2, 2026
@miniprow miniprow Bot added lgtm Indicates that a PR is ready to be merged (Looks Good To Me) approved Indicates a PR has been approved by an approver from all required OWNERS files labels Sep 2, 2026
@miniprow

miniprow Bot commented Sep 2, 2026

Copy link
Copy Markdown
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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@miniprow
miniprow Bot merged commit 6dce4f0 into carabiner-dev:main Sep 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files bug Something isn't working lgtm Indicates that a PR is ready to be merged (Looks Good To Me)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant