Closed
Labels
component:cliCLI componentscomponent:verificationCore verification functionalityenhancementNew feature or request
Milestone
Description
Description
I noticed that Cosign has a series of flags for checking the signing certificate extensions. From the help text:
--certificate-github-workflow-name string contains the workflow claim from the GitHub OIDC Identity token that contains the name of the executed workflow.
--certificate-github-workflow-ref string contains the ref claim from the GitHub OIDC Identity token that contains the git ref that the workflow run was based upon.
--certificate-github-workflow-repository string contains the repository claim from the GitHub OIDC Identity token that contains the repository that the workflow run was based upon
--certificate-github-workflow-sha string contains the sha claim from the GitHub OIDC Identity token that contains the commit SHA that the workflow run was based upon.
--certificate-github-workflow-trigger string contains the event_name claim from the GitHub OIDC Identity token that contains the name of the event that triggered the workflow run
This should be a good fit for @woodruffw's policy API.
Metadata
Metadata
Assignees
Labels
component:cliCLI componentscomponent:verificationCore verification functionalityenhancementNew feature or request
Activity
woodruffw commentedon Nov 29, 2022
Yep! These should map 1-1 to their equivalent policies.
Since
cosignis currently in the process of reducing insecure/ineffective uses of their verification CLI, let's make sure we only allow these flags in ways that don't make policy verification effectively a no-op. For example, we should probably never allow--certificate-github-workflow-triggeron its own, since just about anybody can mint a cert with any particular workflow trigger embedded in its claims.CC @znewman01 and @jku for thoughts (and particularly Zack to make sure we're aligned with
cosignhere).jku commentedon Nov 30, 2022
I still think a usable CLI for this probably requires a service specific "endpoint" (whether it's a separate binary that just uses sigstore-python API or a mode in this cli app) that is somewhat opinionated about what it's doing. So I don't think adding options like this will make the generic CLI better for actually verifying GitHub releases. Alignment with cosign may be a good reason though.
A couple of reasons for my opinion:
--service-specific-claimflags as more services start attesting things?A custom CLI endpoint on the other hand can A) make the inputs simpler and B) can require things that a "generic sigstore client" can not. So just as an example
github-release-verifywith just arguments<repo_name> <workflow_path> <tag> [<sha>]should work (for 99% of cases) and is probably simple enough to use without accidents. Now with the policy API that should be almost trivial to implement.woodruffw commentedon Nov 30, 2022
Yeah, I tend to agree (and, given that
cosignis undergoing significant changes at the same time, this may be an opportunity forsigstore-pythonto prove out a better CLI here).This would be a little more invasive of a change, but I think turning every kind of verification operation into a discrete subcommand of
verifymight be nice, e.g.:This allows us to keep the
<noun> <verb> <noun>CLI pattern, while also letting us do some of the work for the user (e.g.sigstore verify githubimplies that the certificate's issuer can't be anything except the GitHub OIDC issuer, so we can pass that for them).Thoughts?
znewman01 commentedon Dec 5, 2022
I don't believe it is 😄 Cosign has a few design warts
Please do so, sigstore-python is much less calcified and so can do a better job figuring out what this "should" look like. We can then slowly make Cosign look more like that over time if we like it.
Overall I like the plan of specific endpoints for common use cases. I wouldn't hate having an "advanced user escape hatch" for cases where sigstore-python hasn't caught up to some new application, but it doesn't need to be in a first draft.
tetsuo-cpp commentedon Dec 7, 2022
I'm beginning working on this. At this point, I'm liking @woodruffw's design as it leaves us room to extend with more "endpoints" by adding new subcommands after the
verify, without introducing another CLI.What do you think @di?
di commentedon Dec 7, 2022
I like it! As long as we can keep the 'default' endpoint around for a while to maintain backwards compatibility.
woodruffw commentedon Dec 7, 2022
N.B.: It might be a little tricky to do "default" subcommands with
argparse, so we could draft this out under a temporary subcommand (likesigstore verify-v2) until we're ready to stabilize it and swap the behavior out.di commentedon Dec 7, 2022
I guess what I'm concerned about is current 'bare' invocations of
sigstore verifystarting to fail on upgrade because they are missing the new 'endpoint' invocation pattern. I think we should do everything we can to avoid a breaking change like that.[-]Support `--certificate-github-workflow-` flags[/-][+]CLI: Expose verification for GitHub-specific claims[/+]woodruffw commentedon Dec 13, 2022
Posting our latest resolution: we're going to see if we can glue together a compatibility layer with
argparsehere, so that both of the following patterns work:...where the former is an alias/default for the latter.
woodruffw commentedon Jan 3, 2023
Doing this today.
woodruffw commentedon Jan 3, 2023
#379 has the first part of this: it enables
sigstore verify [subcommand], where[subcommand]is optional. I'll do a follow-up PR forsigstore verify githubafter that's in.