From 20c4a67afc2957b5825f0627c6914f6718a0b19a Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Wed, 2 Aug 2023 16:30:04 -0700 Subject: [PATCH] make VerifyImageAttestation function public Signed-off-by: Priya Wadhwa --- pkg/cosign/verify.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cosign/verify.go b/pkg/cosign/verify.go index 2ab846fe596..a1a5426b20e 100644 --- a/pkg/cosign/verify.go +++ b/pkg/cosign/verify.go @@ -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 { @@ -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, @@ -953,7 +954,7 @@ 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) ( @@ -961,7 +962,7 @@ func VerifyBlobAttestation(ctx context.Context, att oci.Signature, h v1.Hash, co 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