Skip to content

Commit 95893d9

Browse files
committed
add --certificate-bundle flag to 'cosign verify'
Related to issue sigstore#3462. Current commit adds the flag to verify the CLI options. The new flag doesn't have any effect yet (will add in follow-up PRs). Signed-off-by: Dmitry S <dsavints@gmail.com>
1 parent 2525c93 commit 95893d9

9 files changed

+22
-7
lines changed

cmd/cosign/cli/options/certificate.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type CertVerifyOptions struct {
3333
CertGithubWorkflowName string
3434
CertGithubWorkflowRepository string
3535
CertGithubWorkflowRef string
36+
CertBundle string
3637
CertChain string
3738
SCT string
3839
IgnoreSCT bool
@@ -75,12 +76,18 @@ func (o *CertVerifyOptions) AddFlags(cmd *cobra.Command) {
7576
cmd.Flags().StringVar(&o.CertGithubWorkflowRef, "certificate-github-workflow-ref", "",
7677
"contains the ref claim from the GitHub OIDC Identity token that contains the git ref that the workflow run was based upon.")
7778
// -- Cert extensions end --
79+
cmd.Flags().StringVar(&o.CertBundle, "certificate-bundle", "",
80+
"path to a bundle file of CA certificates in PEM format which will be needed "+
81+
"when building the certificate chains for the signing certificate. Conflicts with --certificate-chain.")
82+
_ = cmd.Flags().SetAnnotation("certificate-bundle", cobra.BashCompFilenameExt, []string{"cert"})
83+
7884
cmd.Flags().StringVar(&o.CertChain, "certificate-chain", "",
7985
"path to a list of CA certificates in PEM format which will be needed "+
8086
"when building the certificate chain for the signing certificate. "+
8187
"Must start with the parent intermediate CA certificate of the "+
82-
"signing certificate and end with the root certificate")
88+
"signing certificate and end with the root certificate. Conflicts with --certificate-bundle.")
8389
_ = cmd.Flags().SetAnnotation("certificate-chain", cobra.BashCompFilenameExt, []string{"cert"})
90+
cmd.MarkFlagsMutuallyExclusive("certificate-bundle", "certificate-chain")
8491

8592
cmd.Flags().StringVar(&o.SCT, "sct", "",
8693
"path to a detached Signed Certificate Timestamp, formatted as a RFC6962 AddChainResponse struct. "+

cmd/cosign/cli/verify.go

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ against the transparency log.`,
115115
CertGithubWorkflowName: o.CertVerify.CertGithubWorkflowName,
116116
CertGithubWorkflowRepository: o.CertVerify.CertGithubWorkflowRepository,
117117
CertGithubWorkflowRef: o.CertVerify.CertGithubWorkflowRef,
118+
CertBundle: o.CertVerify.CertBundle,
118119
CertChain: o.CertVerify.CertChain,
119120
IgnoreSCT: o.CertVerify.IgnoreSCT,
120121
SCTRef: o.CertVerify.SCT,

cmd/cosign/cli/verify/verify.go

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type VerifyCommand struct {
6060
CertGithubWorkflowName string
6161
CertGithubWorkflowRepository string
6262
CertGithubWorkflowRef string
63+
CertBundle string
6364
CertChain string
6465
CertOidcProvider string
6566
IgnoreSCT bool

doc/cosign_dockerfile_verify.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/cosign_manifest_verify.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/cosign_verify-attestation.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/cosign_verify-blob-attestation.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/cosign_verify-blob.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/cosign_verify.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)