Skip to content

Commit

Permalink
Verify the certificate chain against the Fulcio root trust by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Aug 6, 2022
1 parent 128f8fb commit d43c022
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/cosign/cli/verify/verify_blob.go
Expand Up @@ -119,11 +119,16 @@ func VerifyBlobCmd(ctx context.Context, ko options.KeyOpts, certRef, certEmail,
EnforceSCT: enforceSCT,
}
if certChain == "" {
err = cosign.CheckCertificatePolicy(cert, co)
// If no certChain is passed, the Fulcio root certificate will be used
co.RootCerts, err = fulcio.GetRoots()
if err != nil {
return err
return fmt.Errorf("getting Fulcio roots: %w", err)
}
verifier, err = signature.LoadVerifier(cert.PublicKey, crypto.SHA256)
co.IntermediateCerts, err = fulcio.GetIntermediates()
if err != nil {
return fmt.Errorf("getting Fulcio intermediates: %w", err)
}
verifier, err = cosign.ValidateAndUnpackCert(cert, co)
if err != nil {
return err
}
Expand Down

0 comments on commit d43c022

Please sign in to comment.