Skip to content

Commit 6d7fbf2

Browse files
committed
Move new bundle options to CommonVerifyOptions
Signed-off-by: Cody Soyland <[email protected]>
1 parent ae2b3ba commit 6d7fbf2

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

cmd/cosign/cli/options/certificate.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ type CertVerifyOptions struct {
3838
CertChain string
3939
SCT string
4040
IgnoreSCT bool
41-
NewBundleFormat bool
42-
TrustedRootPath string
4341
}
4442

4543
var _ Interface = (*RekorOptions)(nil)
@@ -105,8 +103,6 @@ func (o *CertVerifyOptions) AddFlags(cmd *cobra.Command) {
105103
cmd.Flags().BoolVar(&o.IgnoreSCT, "insecure-ignore-sct", false,
106104
"when set, verification will not check that a certificate contains an embedded SCT, a proof of "+
107105
"inclusion in a certificate transparency log")
108-
cmd.Flags().StringVar(&o.TrustedRootPath, "trusted-root", "", "Path to a Sigstore TrustedRoot JSON file.")
109-
cmd.Flags().BoolVar(&o.NewBundleFormat, "new-bundle-format", false, "expect the signature/attestation to be packaged in a Sigstore bundle")
110106
}
111107

112108
func (o *CertVerifyOptions) Identities() ([]cosign.Identity, error) {

cmd/cosign/cli/options/verify.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ type CommonVerifyOptions struct {
3131
ExperimentalOCI11 bool
3232
PrivateInfrastructure bool
3333
UseSignedTimestamps bool
34+
NewBundleFormat bool
35+
TrustedRootPath string
3436
}
3537

3638
func (o *CommonVerifyOptions) AddFlags(cmd *cobra.Command) {
@@ -56,6 +58,12 @@ func (o *CommonVerifyOptions) AddFlags(cmd *cobra.Command) {
5658

5759
cmd.Flags().IntVar(&o.MaxWorkers, "max-workers", cosign.DefaultMaxWorkers,
5860
"the amount of maximum workers for parallel executions")
61+
62+
cmd.Flags().StringVar(&o.TrustedRootPath, "trusted-root", "",
63+
"Path to a Sigstore TrustedRoot JSON file.")
64+
65+
cmd.Flags().BoolVar(&o.NewBundleFormat, "new-bundle-format", false,
66+
"expect the signature/attestation to be packaged in a Sigstore bundle")
5967
}
6068

6169
// VerifyOptions is the top level wrapper for the `verify` command.

cmd/cosign/cli/verify.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ The blob may be specified as a path to a file or - for stdin.`,
335335
Slot: o.SecurityKey.Slot,
336336
RekorURL: o.Rekor.URL,
337337
BundlePath: o.BundlePath,
338-
NewBundleFormat: o.CertVerify.NewBundleFormat,
339338
RFC3161TimestampPath: o.RFC3161TimestampPath,
340339
TSACertChainPath: o.CommonVerifyOptions.TSACertChainPath,
340+
NewBundleFormat: o.CommonVerifyOptions.NewBundleFormat,
341341
}
342342
verifyBlobCmd := &verify.VerifyBlobCmd{
343343
KeyOpts: ko,
@@ -347,7 +347,6 @@ The blob may be specified as a path to a file or - for stdin.`,
347347
CARoots: o.CertVerify.CARoots,
348348
CAIntermediates: o.CertVerify.CAIntermediates,
349349
SigRef: o.Signature,
350-
TrustedRootPath: o.CertVerify.TrustedRootPath,
351350
CertGithubWorkflowTrigger: o.CertVerify.CertGithubWorkflowTrigger,
352351
CertGithubWorkflowSHA: o.CertVerify.CertGithubWorkflowSha,
353352
CertGithubWorkflowName: o.CertVerify.CertGithubWorkflowName,
@@ -358,6 +357,7 @@ The blob may be specified as a path to a file or - for stdin.`,
358357
Offline: o.CommonVerifyOptions.Offline,
359358
IgnoreTlog: o.CommonVerifyOptions.IgnoreTlog,
360359
UseSignedTimestamps: o.CommonVerifyOptions.UseSignedTimestamps,
360+
TrustedRootPath: o.CommonVerifyOptions.TrustedRootPath,
361361
}
362362

363363
ctx, cancel := context.WithTimeout(cmd.Context(), ro.Timeout)
@@ -406,17 +406,16 @@ The blob may be specified as a path to a file.`,
406406
Slot: o.SecurityKey.Slot,
407407
RekorURL: o.Rekor.URL,
408408
BundlePath: o.BundlePath,
409-
NewBundleFormat: o.CertVerify.NewBundleFormat,
410409
RFC3161TimestampPath: o.RFC3161TimestampPath,
411410
TSACertChainPath: o.CommonVerifyOptions.TSACertChainPath,
411+
NewBundleFormat: o.CommonVerifyOptions.NewBundleFormat,
412412
}
413413
v := verify.VerifyBlobAttestationCommand{
414414
KeyOpts: ko,
415415
PredicateType: o.PredicateOptions.Type,
416416
CheckClaims: o.CheckClaims,
417417
SignaturePath: o.SignaturePath,
418418
CertVerifyOptions: o.CertVerify,
419-
TrustedRootPath: o.CertVerify.TrustedRootPath,
420419
CertRef: o.CertVerify.Cert,
421420
CertChain: o.CertVerify.CertChain,
422421
CARoots: o.CertVerify.CARoots,
@@ -431,6 +430,7 @@ The blob may be specified as a path to a file.`,
431430
Offline: o.CommonVerifyOptions.Offline,
432431
IgnoreTlog: o.CommonVerifyOptions.IgnoreTlog,
433432
UseSignedTimestamps: o.CommonVerifyOptions.UseSignedTimestamps,
433+
TrustedRootPath: o.CommonVerifyOptions.TrustedRootPath,
434434
}
435435
// We only use the blob if we are checking claims.
436436
if len(args) == 0 && o.CheckClaims {

cmd/cosign/cli/verify/verify.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
type VerifyCommand struct {
5353
options.RegistryOptions
5454
options.CertVerifyOptions
55+
options.CommonVerifyOptions
5556
CheckClaims bool
5657
KeyRef string
5758
CertRef string

cmd/cosign/cli/verify/verify_attestation.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545
type VerifyAttestationCommand struct {
4646
options.RegistryOptions
4747
options.CertVerifyOptions
48+
options.CommonVerifyOptions
4849
CheckClaims bool
4950
KeyRef string
5051
CertRef string

0 commit comments

Comments
 (0)