Skip to content

Commit 3329d81

Browse files
Don't require CT log keys if using a key/sk (#3415)
Fixes #3386. The logic was inverted for this check. Signed-off-by: Hayden Blauzvern <[email protected]>
1 parent d329bf7 commit 3329d81

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

cmd/cosign/cli/verify/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (c *VerifyCommand) Exec(ctx context.Context, images []string) (err error) {
207207
certRef := c.CertRef
208208

209209
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
210-
if !c.IgnoreSCT || keyRef != "" {
210+
if !c.IgnoreSCT || keylessVerification(c.KeyRef, c.Sk) {
211211
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
212212
if err != nil {
213213
return fmt.Errorf("getting ctlog public keys: %w", err)

cmd/cosign/cli/verify/verify_attestation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (c *VerifyAttestationCommand) Exec(ctx context.Context, images []string) (e
111111
co.ClaimVerifier = cosign.IntotoSubjectClaimVerifier
112112
}
113113
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
114-
if !c.IgnoreSCT || c.KeyRef != "" {
114+
if !c.IgnoreSCT || keylessVerification(c.KeyRef, c.Sk) {
115115
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
116116
if err != nil {
117117
return fmt.Errorf("getting ctlog public keys: %w", err)

cmd/cosign/cli/verify/verify_blob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (c *VerifyBlobCmd) Exec(ctx context.Context, blobRef string) error {
286286
}
287287

288288
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
289-
if !c.IgnoreSCT || c.KeyRef != "" {
289+
if !c.IgnoreSCT || keylessVerification(c.KeyRef, c.Sk) {
290290
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
291291
if err != nil {
292292
return fmt.Errorf("getting ctlog public keys: %w", err)

cmd/cosign/cli/verify/verify_blob_attestation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (c *VerifyBlobAttestationCommand) Exec(ctx context.Context, artifactPath st
190190
}
191191
}
192192
// Ignore Signed Certificate Timestamp if the flag is set or a key is provided
193-
if !c.IgnoreSCT || c.KeyRef != "" {
193+
if !c.IgnoreSCT || keylessVerification(c.KeyRef, c.Sk) {
194194
co.CTLogPubKeys, err = cosign.GetCTLogPubs(ctx)
195195
if err != nil {
196196
return fmt.Errorf("getting ctlog public keys: %w", err)

0 commit comments

Comments
 (0)