Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate --certificate-email flag. Make --certificate-identity and -… #2411

Merged
merged 51 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
25e49e4
Deprecate --certificate-email flag. Make --certificate-identity and -…
kpk47 Nov 2, 2022
b7e1548
Make --cert-email and --cert-identity mutually exclusive
kpk47 Nov 3, 2022
8566156
Remove --certificate-email flag
kpk47 Nov 4, 2022
9602e9d
docgen
kpk47 Nov 4, 2022
21482bd
lint
kpk47 Nov 4, 2022
4f5d609
lint
kpk47 Nov 4, 2022
f223f6e
Enforce requiring --certificate-identity and --certificate-oidc-issue…
kpk47 Nov 4, 2022
e5e9636
Move argument checks to Exec() functions.
kpk47 Nov 7, 2022
8cc212f
Don't require cert-identity or cert-oidc-issuer in keyed mode
kpk47 Nov 7, 2022
12cae1c
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 7, 2022
803a341
fix mismerge
kpk47 Nov 7, 2022
3babacb
Change e2e blob and attestation tests to use keys.
kpk47 Nov 9, 2022
4835f5f
Add workflow_dispatch trigger to attestation e2e tests
kpk47 Nov 9, 2022
3fc8332
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 9, 2022
c21c197
fix e2e test
kpk47 Nov 9, 2022
902b53e
typo
kpk47 Nov 9, 2022
6c11e62
typo
kpk47 Nov 9, 2022
68ce699
debugging workflow
kpk47 Nov 10, 2022
032cc39
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 10, 2022
5dd8f2b
fix attest e2e test
kpk47 Nov 10, 2022
357452f
fix attest e2e test
kpk47 Nov 10, 2022
35a21e5
removing debug print statements
kpk47 Nov 10, 2022
c4c04f2
test e2e keyless
kpk47 Nov 11, 2022
a545b14
remove flags to trigger error
kpk47 Nov 11, 2022
61de5bc
change sign_blob e2e test to use local bundles
kpk47 Nov 11, 2022
f30b015
Add tests for missing flags
kpk47 Nov 11, 2022
2f87646
typos
kpk47 Nov 11, 2022
d2a12a3
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 11, 2022
1c84341
typos
kpk47 Nov 11, 2022
655fb48
Move error checking into CheckVerifyOptions
kpk47 Nov 12, 2022
fb1764a
unit test
kpk47 Nov 12, 2022
3a7b802
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 15, 2022
b0a121d
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Nov 29, 2022
8bc1a06
Re-disable e2e sign-blob-test. It can't run on GHA
kpk47 Nov 29, 2022
cc2fc0e
debug verify attestation test
kpk47 Dec 1, 2022
7733f76
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Dec 16, 2022
a0857c1
Fix verify-attestation args
kpk47 Dec 16, 2022
2c59469
debug attestation
kpk47 Dec 16, 2022
15cfa8d
debug verify-blob args
kpk47 Dec 19, 2022
1f35b49
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Dec 19, 2022
858ee99
fix sign-blob integration test; remove debug print statements
kpk47 Dec 19, 2022
98e66d9
add regexp flags
kpk47 Dec 19, 2022
6868f71
docgen
kpk47 Dec 19, 2022
fc654cd
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Dec 20, 2022
f8431d9
update test cert and enable sign-blob e2e test
kpk47 Dec 21, 2022
034855f
Remove sign-blob e2e test from workflow. It requires human interaction
kpk47 Dec 21, 2022
a756b95
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Dec 21, 2022
45fd981
re-enable sign-blob e2e test using GH credentials
kpk47 Dec 21, 2022
04c940d
fix workflow permissions
kpk47 Dec 21, 2022
e84a33d
re-disable sign-blob tests. Changing workflow permissions didn't help
kpk47 Dec 21, 2022
820bf93
Merge branch 'main' of github.com:sigstore/cosign into flags
kpk47 Dec 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cosign/cli/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Shell-like variables in the Dockerfile's FROM lines will be substituted with val
CheckClaims: o.CheckClaims,
KeyRef: o.Key,
CertRef: o.CertVerify.Cert,
CertEmail: o.CertVerify.CertEmail,
CertIdentity: o.CertVerify.CertIdentity,
CertOidcIssuer: o.CertVerify.CertOidcIssuer,
CertGithubWorkflowTrigger: o.CertVerify.CertGithubWorkflowTrigger,
CertGithubWorkflowSha: o.CertVerify.CertGithubWorkflowSha,
Expand Down
2 changes: 1 addition & 1 deletion cmd/cosign/cli/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ against the transparency log.`,
CheckClaims: o.CheckClaims,
KeyRef: o.Key,
CertRef: o.CertVerify.Cert,
CertEmail: o.CertVerify.CertEmail,
CertIdentity: o.CertVerify.CertIdentity,
CertOidcIssuer: o.CertVerify.CertOidcIssuer,
CertGithubWorkflowTrigger: o.CertVerify.CertGithubWorkflowTrigger,
CertGithubWorkflowSha: o.CertVerify.CertGithubWorkflowSha,
Expand Down
8 changes: 2 additions & 6 deletions cmd/cosign/cli/options/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
// CertVerifyOptions is the wrapper for certificate verification.
type CertVerifyOptions struct {
Cert string
CertEmail string
CertIdentity string
CertOidcIssuer string
CertGithubWorkflowTrigger string
Expand All @@ -41,14 +40,11 @@ func (o *CertVerifyOptions) AddFlags(cmd *cobra.Command) {
"path to the public certificate. The certificate will be verified against the Fulcio roots if the --certificate-chain option is not passed.")
_ = cmd.Flags().SetAnnotation("certificate", cobra.BashCompFilenameExt, []string{"cert"})

cmd.Flags().StringVar(&o.CertEmail, "certificate-email", "",
"the email expected in a valid Fulcio certificate")

cmd.Flags().StringVar(&o.CertIdentity, "certificate-identity", "",
"the identity expected in a valid Fulcio certificate. Valid values include email address, DNS names, IP addresses, and URIs.")
"Required. The identity expected in a valid Fulcio certificate. Valid values include email address, DNS names, IP addresses, and URIs.")
kpk47 marked this conversation as resolved.
Show resolved Hide resolved

cmd.Flags().StringVar(&o.CertOidcIssuer, "certificate-oidc-issuer", "",
"the OIDC issuer expected in a valid Fulcio certificate, e.g. https://token.actions.githubusercontent.com or https://oauth2.sigstore.dev/auth")
"Required. The OIDC issuer expected in a valid Fulcio certificate, e.g. https://token.actions.githubusercontent.com or https://oauth2.sigstore.dev/auth")

// -- Cert extensions begin --
// Source: https://github.com/sigstore/fulcio/blob/main/docs/oid-info.md
Expand Down
3 changes: 0 additions & 3 deletions cmd/cosign/cli/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ against the transparency log.`,
CheckClaims: o.CheckClaims,
KeyRef: o.Key,
CertRef: o.CertVerify.Cert,
CertEmail: o.CertVerify.CertEmail,
CertIdentity: o.CertVerify.CertIdentity,
CertOidcIssuer: o.CertVerify.CertOidcIssuer,
CertGithubWorkflowTrigger: o.CertVerify.CertGithubWorkflowTrigger,
Expand Down Expand Up @@ -186,7 +185,6 @@ against the transparency log.`,
RegistryOptions: o.Registry,
CheckClaims: o.CheckClaims,
CertRef: o.CertVerify.Cert,
CertEmail: o.CertVerify.CertEmail,
CertIdentity: o.CertVerify.CertIdentity,
CertOidcIssuer: o.CertVerify.CertOidcIssuer,
CertChain: o.CertVerify.CertChain,
Expand Down Expand Up @@ -276,7 +274,6 @@ The blob may be specified as a path to a file or - for stdin.`,
verifyBlobCmd := verify.VerifyBlobCmd{
KeyOpts: ko,
CertRef: o.CertVerify.Cert,
CertEmail: o.CertVerify.CertEmail,
CertIdentity: o.CertVerify.CertIdentity,
CertOIDCIssuer: o.CertVerify.CertOidcIssuer,
CertChain: o.CertVerify.CertChain,
Expand Down
5 changes: 1 addition & 4 deletions cmd/cosign/cli/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ type VerifyCommand struct {
CheckClaims bool
KeyRef string
CertRef string
CertEmail string
CertIdentity string
CertOidcIssuer string
CertGithubWorkflowTrigger string
Expand Down Expand Up @@ -99,16 +98,14 @@ func (c *VerifyCommand) Exec(ctx context.Context, images []string) (err error) {
co := &cosign.CheckOpts{
Annotations: c.Annotations.Annotations,
RegistryClientOpts: ociremoteOpts,
CertEmail: c.CertEmail,
CertIdentity: c.CertIdentity,
CertOidcIssuer: c.CertOidcIssuer,
CertGithubWorkflowTrigger: c.CertGithubWorkflowTrigger,
CertGithubWorkflowSha: c.CertGithubWorkflowSha,
CertGithubWorkflowName: c.CertGithubWorkflowName,
CertGithubWorkflowRepository: c.CertGithubWorkflowRepository,
CertGithubWorkflowRef: c.CertGithubWorkflowRef,
EnforceSCT: c.EnforceSCT,
SignatureRef: c.SignatureRef,
Identities: []cosign.Identity{{Issuer: c.CertOidcIssuer, Subject: c.CertIdentity}},
}
if c.CheckClaims {
co.ClaimVerifier = cosign.SimpleClaimVerifier
Expand Down
5 changes: 1 addition & 4 deletions cmd/cosign/cli/verify/verify_attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type VerifyAttestationCommand struct {
CheckClaims bool
KeyRef string
CertRef string
CertEmail string
CertIdentity string
CertOidcIssuer string
CertGithubWorkflowTrigger string
Expand Down Expand Up @@ -81,15 +80,13 @@ func (c *VerifyAttestationCommand) Exec(ctx context.Context, images []string) (e
}
co := &cosign.CheckOpts{
RegistryClientOpts: ociremoteOpts,
CertEmail: c.CertEmail,
CertIdentity: c.CertIdentity,
CertOidcIssuer: c.CertOidcIssuer,
CertGithubWorkflowTrigger: c.CertGithubWorkflowTrigger,
CertGithubWorkflowSha: c.CertGithubWorkflowSha,
CertGithubWorkflowName: c.CertGithubWorkflowName,
CertGithubWorkflowRepository: c.CertGithubWorkflowRepository,
CertGithubWorkflowRef: c.CertGithubWorkflowRef,
EnforceSCT: c.EnforceSCT,
Identities: []cosign.Identity{{Issuer: c.CertOidcIssuer, Subject: c.CertIdentity}},
}
if c.CheckClaims {
co.ClaimVerifier = cosign.IntotoSubjectClaimVerifier
Expand Down
5 changes: 1 addition & 4 deletions cmd/cosign/cli/verify/verify_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func isb64(data []byte) bool {
type VerifyBlobCmd struct {
options.KeyOpts
CertRef string
CertEmail string
CertIdentity string
CertOIDCIssuer string
CertChain string
Expand Down Expand Up @@ -102,15 +101,13 @@ func (c *VerifyBlobCmd) Exec(ctx context.Context, blobRef string) error {
}

co := &cosign.CheckOpts{
CertEmail: c.CertEmail,
CertIdentity: c.CertIdentity,
CertOidcIssuer: c.CertOIDCIssuer,
CertGithubWorkflowTrigger: c.CertGithubWorkflowTrigger,
CertGithubWorkflowSha: c.CertGithubWorkflowSHA,
CertGithubWorkflowName: c.CertGithubWorkflowName,
CertGithubWorkflowRepository: c.CertGithubWorkflowRepository,
CertGithubWorkflowRef: c.CertGithubWorkflowRef,
EnforceSCT: c.EnforceSCT,
Identities: []cosign.Identity{{Issuer: c.CertOIDCIssuer, Subject: c.CertIdentity}},
}
if options.EnableExperimental() {
if c.RekorURL != "" {
Expand Down
45 changes: 25 additions & 20 deletions cmd/cosign/cli/verify/verify_blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ func TestVerifyBlob(t *testing.T) {
co := &cosign.CheckOpts{
SigVerifier: tt.sigVerifier,
RootCerts: rootPool,
Identities: []cosign.Identity{{Issuer: issuer, Subject: identity}},
}
// if expermental is enabled, add RekorClient to co.
if tt.experimental {
Expand Down Expand Up @@ -719,7 +720,7 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
// Verify command
cmd := VerifyBlobCmd{
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
CertEmail: identity,
CertIdentity: identity,
CertOIDCIssuer: issuer,
EnforceSCT: false,
}
Expand Down Expand Up @@ -817,11 +818,13 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {

// Verify command
cmd := VerifyBlobCmd{
CertRef: "", // Cert is fetched from bundle
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
EnforceSCT: false,
CertIdentity: identity,
CertOIDCIssuer: issuer,
CertRef: "", // Cert is fetched from bundle
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
EnforceSCT: false,
}
if err := cmd.Exec(context.Background(), blobPath); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -850,11 +853,13 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {

// Verify command
cmd := VerifyBlobCmd{
CertRef: "", // Cert is fetched from bundle
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
EnforceSCT: false,
CertIdentity: identity,
CertOIDCIssuer: issuer,
CertRef: "", // Cert is fetched from bundle
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
EnforceSCT: false,
}
err = cmd.Exec(context.Background(), blobPath)
if err == nil || !strings.Contains(err.Error(), "unable to verify SET") {
Expand Down Expand Up @@ -887,13 +892,13 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
CertRef: "", // Cert is fetched from bundle
CertOIDCIssuer: issuer,
CertEmail: "[email protected]",
CertIdentity: "[email protected]",
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
EnforceSCT: false,
}
err = cmd.Exec(context.Background(), blobPath)
if err == nil || !strings.Contains(err.Error(), "expected identity not found in certificate") {
if err == nil || !strings.Contains(err.Error(), "none of the expected identities matched what was in the certificate") {
t.Fatalf("expected error with mismatched identity, got %v", err)
}
})
Expand Down Expand Up @@ -922,14 +927,14 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
cmd := VerifyBlobCmd{
CertRef: "", // Cert is fetched from bundle
CertOIDCIssuer: "invalid",
CertEmail: identity,
CertIdentity: identity,
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
EnforceSCT: false,
}
err = cmd.Exec(context.Background(), blobPath)
if err == nil || !strings.Contains(err.Error(), "expected oidc issuer not found in certificate") {
if err == nil || !strings.Contains(err.Error(), "none of the expected identities matched what was in the certificate") {
t.Fatalf("expected error with mismatched issuer, got %v", err)
}
})
Expand Down Expand Up @@ -959,7 +964,7 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
cmd := VerifyBlobCmd{
CertRef: certPath,
CertOIDCIssuer: issuer,
CertEmail: identity,
CertIdentity: identity,
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
Expand Down Expand Up @@ -994,7 +999,7 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
// Verify command
cmd := VerifyBlobCmd{
CertOIDCIssuer: issuer,
CertEmail: identity,
CertIdentity: identity,
CertChain: os.Getenv("SIGSTORE_ROOT_FILE"),
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
Expand Down Expand Up @@ -1040,7 +1045,7 @@ func TestVerifyBlobCmdWithBundle(t *testing.T) {
// Verify command
cmd := VerifyBlobCmd{
CertOIDCIssuer: issuer,
CertEmail: identity,
CertIdentity: identity,
CertChain: tmpChainFile.Name(),
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
Expand Down Expand Up @@ -1083,7 +1088,7 @@ func TestVerifyBlobCmdInvalidRootCA(t *testing.T) {
cmd := VerifyBlobCmd{
CertRef: certPath,
CertOIDCIssuer: issuer,
CertEmail: identity,
CertIdentity: identity,
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
Expand Down Expand Up @@ -1119,7 +1124,7 @@ func TestVerifyBlobCmdInvalidRootCA(t *testing.T) {
cmd := VerifyBlobCmd{
CertRef: "",
CertOIDCIssuer: issuer, // Fetched from bundle
CertEmail: identity,
CertIdentity: identity,
CertChain: "", // Chain is fetched from TUF/SIGSTORE_ROOT_FILE
SigRef: "", // Sig is fetched from bundle
KeyOpts: options.KeyOpts{BundlePath: bundlePath},
Expand Down
5 changes: 2 additions & 3 deletions doc/cosign_dockerfile_verify.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions doc/cosign_manifest_verify.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading