From adfe2e368aff98b528447ded17dcd1ed4fbc955f Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Wed, 19 Feb 2025 17:00:28 -0500 Subject: [PATCH] Return error if no bundles exist in registry Signed-off-by: Cody Soyland --- pkg/cosign/verify.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cosign/verify.go b/pkg/cosign/verify.go index 126d66fd4e9..6fc3fedd2d3 100644 --- a/pkg/cosign/verify.go +++ b/pkg/cosign/verify.go @@ -1551,6 +1551,12 @@ func getBundles(_ context.Context, signedImgRef name.Reference, co *CheckOpts) ( bundles = append(bundles, bundle) } + if len(bundles) == 0 { + return nil, nil, &ErrNoMatchingAttestations{ + fmt.Errorf("no valid bundles exist in registry"), + } + } + return bundles, &h, nil }