Skip to content

Commit

Permalink
Fixes #3236, disable SCT checking for a cosign verification when usin… (
Browse files Browse the repository at this point in the history
#3237)

* Fixes #3236, disable SCT checking for a cosign verification when using a public key

Signed-off-by: John Kjell <[email protected]>

* Update additional verify functionality

Signed-off-by: John Kjell <[email protected]>

---------

Signed-off-by: John Kjell <[email protected]>
  • Loading branch information
jkjell authored Sep 12, 2023
1 parent 86252aa commit 1ee8bf9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/cosign/cli/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ func (c *VerifyCommand) Exec(ctx context.Context, images []string) (err error) {
keyRef := c.KeyRef
certRef := c.CertRef

if !c.IgnoreSCT {
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
if !c.IgnoreSCT || keyRef != "" {
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
if err != nil {
return fmt.Errorf("getting ctlog public keys: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cosign/cli/verify/verify_attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (c *VerifyAttestationCommand) Exec(ctx context.Context, images []string) (e
if c.CheckClaims {
co.ClaimVerifier = cosign.IntotoSubjectClaimVerifier
}
if !c.IgnoreSCT {
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
if !c.IgnoreSCT || c.KeyRef != "" {
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
if err != nil {
return fmt.Errorf("getting ctlog public keys: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cosign/cli/verify/verify_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ func (c *VerifyBlobCmd) Exec(ctx context.Context, blobRef string) error {
opts = append(opts, static.WithCertChain(certPEM, chainPEM))
}

if !c.IgnoreSCT {
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
if !c.IgnoreSCT || c.KeyRef != "" {
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
if err != nil {
return fmt.Errorf("getting ctlog public keys: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cosign/cli/verify/verify_blob_attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ func (c *VerifyBlobAttestationCommand) Exec(ctx context.Context, artifactPath st
}
}
}
if !c.IgnoreSCT {
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
if !c.IgnoreSCT || c.KeyRef != "" {
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
if err != nil {
return fmt.Errorf("getting ctlog public keys: %w", err)
Expand Down

0 comments on commit 1ee8bf9

Please sign in to comment.