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

Make VerifyImageAttestation function public #3156

Merged
merged 1 commit into from
Aug 3, 2023
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
7 changes: 4 additions & 3 deletions pkg/cosign/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ func verifySignatures(ctx context.Context, sigs oci.Signatures, h v1.Hash, co *C
t.Done(err)
return
}

verified, err := VerifyImageSignature(ctx, sig, h, co)
bundlesVerified[index] = verified
if err != nil {
Expand Down Expand Up @@ -907,7 +908,7 @@ func VerifyImageAttestations(ctx context.Context, signedImgRef name.Reference, c
return nil, false, err
}

return verifyImageAttestations(ctx, atts, h, co)
return VerifyImageAttestation(ctx, atts, h, co)
}

// VerifyLocalImageAttestations verifies attestations from a saved, local image, without any network calls,
Expand Down Expand Up @@ -953,15 +954,15 @@ func VerifyLocalImageAttestations(ctx context.Context, path string, co *CheckOpt
if err != nil {
return nil, false, err
}
return verifyImageAttestations(ctx, atts, h, co)
return VerifyImageAttestation(ctx, atts, h, co)
}

func VerifyBlobAttestation(ctx context.Context, att oci.Signature, h v1.Hash, co *CheckOpts) (
bool, error) {
return verifyInternal(ctx, att, h, verifyOCIAttestation, co)
}

func verifyImageAttestations(ctx context.Context, atts oci.Signatures, h v1.Hash, co *CheckOpts) (checkedAttestations []oci.Signature, bundleVerified bool, err error) {
func VerifyImageAttestation(ctx context.Context, atts oci.Signatures, h v1.Hash, co *CheckOpts) (checkedAttestations []oci.Signature, bundleVerified bool, err error) {
sl, err := atts.Get()
if err != nil {
return nil, false, err
Expand Down
Loading