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

Don't fail open in VerifyBundle #1648

Merged
merged 1 commit into from Apr 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions pkg/cosign/verify.go
Expand Up @@ -757,13 +757,14 @@ func VerifyBundle(ctx context.Context, sig oci.Signature) (bool, error) {
cert, err := sig.Cert()
if err != nil {
return false, err
} else if cert == nil {
return true, nil
}

// verify the cert against the integrated time
if err := CheckExpiry(cert, time.Unix(bundle.Payload.IntegratedTime, 0)); err != nil {
return false, errors.Wrap(err, "checking expiry on cert")
if cert != nil {
// Verify the cert against the integrated time.
// Note that if the caller requires the certificate to be present, it has to ensure that itself.
if err := CheckExpiry(cert, time.Unix(bundle.Payload.IntegratedTime, 0)); err != nil {
return false, errors.Wrap(err, "checking expiry on cert")
}
}

payload, err := sig.Payload()
Expand Down