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

fix: add COSIGN_EXPERIMENTAL=1 for verify-bloba #2254

Merged
merged 1 commit into from Sep 18, 2022

Conversation

developer-guy
Copy link
Member

Signed-off-by: Batuhan Apaydın batuhan.apaydin@trendyol.com

Summary

Release Note

Documentation

@haydentherapper
Copy link
Contributor

haydentherapper commented Sep 15, 2022

/hold

Most of these cases do no require the flag.

@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2022

Codecov Report

Merging #2254 (4e729c3) into main (f43839b) will increase coverage by 0.16%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #2254      +/-   ##
==========================================
+ Coverage   28.40%   28.57%   +0.16%     
==========================================
  Files         131      131              
  Lines        7832     7852      +20     
==========================================
+ Hits         2225     2244      +19     
+ Misses       5309     5302       -7     
- Partials      298      306       +8     
Impacted Files Coverage Δ
cmd/cosign/cli/verify.go 0.00% <0.00%> (ø)
cmd/cosign/cli/verify/verify_blob.go 45.26% <0.00%> (+0.35%) ⬆️
cmd/cosign/cli/verify/verify.go 5.97% <0.00%> (+2.61%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


# Verify a simple blob and message
cosign verify-blob --key cosign.pub --signature sig msg
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key cosign.pub --signature sig msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no flag required for all examples with a key

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, including the KMS ones. Anything without --certificate I think


# Verify a signature against a certificate
cosign verify-blob --cert <cert> --signature $sig <blob>
COSIGN_EXPERIMENTAL=1 cosign verify-blob --cert <cert> --signature $sig <blob>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update to --certificate?


# Verify a signature against a certificate
cosign verify-blob --cert <cert> --signature $sig <blob>
COSIGN_EXPERIMENTAL=1 cosign verify-blob --cert <cert> --signature $sig <blob>
`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asraa Should we use the list you made of all possible flag combos (cert/key, experimental/no experimental, bundle, expired/unexpired cert) and have an example for each of these with more explanation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Further, I'd like to see some organization and explanation. Right now, the text is just a laundry list of "if X, then Y"

We should explain unset COSIGN_EXPERIMENTAL and COSIGN_EXPERIMENTAL=1 separately (I don't 100% understand the current behavior so please correct me, indicated uncertainty with "?")

Here's a braindump, maybe should move into Google Doc (feel free to copy it)

no experimental

Check the signature on a blob against the given key or certificate.

Keys

blah

Certificates

  • --certificate and --certificate-chain example:

    The provided certificate (and all of the certificates in the chain(?) must be unexpired right now.

    NOTE: this just accepts whatever the last certificate of the chain is as your root. If you want to check that it matches a fixed root certificate, use keyless mode and SIGSTORE_ROOT_FILE (except we don't want people to do that? what do we tell these people?)

  • --certificate no chain

    Checks that the certificate is signed by Fulcio (must be unexpired). Will that ever work?

Bundles

  • --bundle

    If --bundle is provided, use the given Rekor bundle (see ...) to check that the time of the signature was while the certificate (and its ancestors??) were valid (without --bundle, the certificate must be currently valid).

    Works for keys and certs both.

    What happens if the bundle has a conflicting chain?

  • --bundle + certs, no chain

    If there's a bundle use that to get the chain up to Fulcio?

experimental

Keys

Same as above, but we check that signatures are in Rekor (I think?)

If --bundle provided, check that against Rekor (offline).

Certs

  • --certificate and --certificate-chain: Like the keyfull version, except instead of automatically trusting the certificate chain, we check that the root matches Fulcio's cert.

    If you'd like to BYO-root, set SIGSTORE_ROOT_FILE and we'll compare the root of the chain against that.

    We hit Rekor online.

  • --certificate, no chain: this would only work if signed by the root directly, which probably won't be the case (maybe if you BYO-root?)

Bundles

  • --keys Same as above, don't hit Rekor.

  • --certificate and --certificate-chain and --bundle. Same as above, don't hit rekor

    TODO: what if bundle has a conflicting cert/chain?

  • --certificate and --bundle: Same, but use a chain from bundle. Fails if bundle has no chain.

    TODO: what happens if the bundle has a conflicting cert?

  • --bundle: Same, but use cert/chain from bundle. Fails if bundle has no cert/chain.

    TODO: if the bundle just provides a key, do we trust it?


# Verify a simple blob with remote signature URL, both http and https schemes are supported
cosign verify-blob --key cosign.pub --signature http://host/my.sig
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key cosign.pub --signature http://host/my.sig

# Verify a signature from an environment variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's axe this example? it's just explaining how the environment variables work in a shell, I think


# Verify a signature from an environment variable
cosign verify-blob --key cosign.pub --signature $sig msg
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key cosign.pub --signature $sig msg

# verify a signature with public key provided by URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine this with the "signature from URL" example?


# verify a signature with public key provided by URL
cosign verify-blob --key https://host.for/<FILE> --signature $sig msg
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key https://host.for/<FILE> --signature $sig msg

# Verify a signature against a payload from another process using process redirection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, axe this example. Maybe we can move it to the docs/ directory of the Cosign repo. Or even a "useful tricks" section at the bottom of this doc.


# Verify a signature against a payload from another process using process redirection
cosign verify-blob --key cosign.pub --signature $sig <(git rev-parse HEAD)
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key cosign.pub --signature $sig <(git rev-parse HEAD)

# Verify a signature against Azure Key Vault
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to combine all the KMS examples. It'd be nice to list the syntax for each, but I don't need it in the full context.


# Verify a simple blob and message
cosign verify-blob --key cosign.pub --signature sig msg
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key cosign.pub --signature sig msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, including the KMS ones. Anything without --certificate I think


# verify a signature with public key provided by URL
cosign verify-blob --key https://host.for/<FILE> --signature $sig msg
COSIGN_EXPERIMENTAL=1 cosign verify-blob --key https://host.for/<FILE> --signature $sig msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/$sig/<sig>


# Verify a signature against a certificate
cosign verify-blob --cert <cert> --signature $sig <blob>
COSIGN_EXPERIMENTAL=1 cosign verify-blob --cert <cert> --signature $sig <blob>
`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Further, I'd like to see some organization and explanation. Right now, the text is just a laundry list of "if X, then Y"

We should explain unset COSIGN_EXPERIMENTAL and COSIGN_EXPERIMENTAL=1 separately (I don't 100% understand the current behavior so please correct me, indicated uncertainty with "?")

Here's a braindump, maybe should move into Google Doc (feel free to copy it)

no experimental

Check the signature on a blob against the given key or certificate.

Keys

blah

Certificates

  • --certificate and --certificate-chain example:

    The provided certificate (and all of the certificates in the chain(?) must be unexpired right now.

    NOTE: this just accepts whatever the last certificate of the chain is as your root. If you want to check that it matches a fixed root certificate, use keyless mode and SIGSTORE_ROOT_FILE (except we don't want people to do that? what do we tell these people?)

  • --certificate no chain

    Checks that the certificate is signed by Fulcio (must be unexpired). Will that ever work?

Bundles

  • --bundle

    If --bundle is provided, use the given Rekor bundle (see ...) to check that the time of the signature was while the certificate (and its ancestors??) were valid (without --bundle, the certificate must be currently valid).

    Works for keys and certs both.

    What happens if the bundle has a conflicting chain?

  • --bundle + certs, no chain

    If there's a bundle use that to get the chain up to Fulcio?

experimental

Keys

Same as above, but we check that signatures are in Rekor (I think?)

If --bundle provided, check that against Rekor (offline).

Certs

  • --certificate and --certificate-chain: Like the keyfull version, except instead of automatically trusting the certificate chain, we check that the root matches Fulcio's cert.

    If you'd like to BYO-root, set SIGSTORE_ROOT_FILE and we'll compare the root of the chain against that.

    We hit Rekor online.

  • --certificate, no chain: this would only work if signed by the root directly, which probably won't be the case (maybe if you BYO-root?)

Bundles

  • --keys Same as above, don't hit Rekor.

  • --certificate and --certificate-chain and --bundle. Same as above, don't hit rekor

    TODO: what if bundle has a conflicting cert/chain?

  • --certificate and --bundle: Same, but use a chain from bundle. Fails if bundle has no chain.

    TODO: what happens if the bundle has a conflicting cert?

  • --bundle: Same, but use cert/chain from bundle. Fails if bundle has no cert/chain.

    TODO: if the bundle just provides a key, do we trust it?

@developer-guy developer-guy force-pushed the feature/verify-blob branch 2 times, most recently from 0601020 to 1357e32 Compare September 16, 2022 15:13
@developer-guy
Copy link
Member Author

I tried to address some of the reviews. Can you please take a look at @znewman01? Thx

Copy link
Contributor

@znewman01 znewman01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of minor issues, but otherwise I think this looks good. We may want to totally rework the docs here, but that can happen later.

cmd/cosign/cli/verify.go Outdated Show resolved Hide resolved
cmd/cosign/cli/verify.go Outdated Show resolved Hide resolved
cmd/cosign/cli/verify.go Outdated Show resolved Hide resolved
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants