Skip to content
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

fix(follow): pass full repo+sha to the signature verification function #323

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/follower/follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,21 @@ func (f *Follower) pull(ctx context.Context) (filePaths []string, res *oci.Regis
return filePaths, res, fmt.Errorf("unable to pull artifact %q: %w", f.ref, err)
}

repo, err := utils.RepositoryFromRef(f.ref)
if err != nil {
return filePaths, res, err
}

digestRef := fmt.Sprintf("%s@%s", repo, res.RootDigest)

// Verify the signature if needed
if f.Config.Signature != nil {
f.Verbosef("verifying signature")
err = signature.Verify(ctx, res.RootDigest, f.Config.Signature)
f.Verbosef("verifying signature for %s", digestRef)
err = signature.Verify(ctx, digestRef, f.Config.Signature)
if err != nil {
return filePaths, res, fmt.Errorf("could not verify signature for %s: %w", res.RootDigest, err)
}
f.Verbosef("signature successfully verified")
}

f.Verbosef("extracting artifact")
Expand Down