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

Print in-toto statement when verifying DSSE #1116

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

facutuesca
Copy link
Collaborator

Summary

Part of #1111. This changes the sigstore verify CLI command so that when verifying a bundle containing a DSSE envelope, if verification succeeds the inner in-toto statement is printed to the user.

$ sigstore verify identity README.md --cert-identity me@example.com --cert-oidc-issuer https://issuer.example.com
OK: README.md
{"_type":"https://in-toto.io/Statement/v1","subject":[{"name":"README.md","digest":{"sha256":"033be49064ed2a5f50bf81950f38741a8c550bc8076447452152c7b9d28728bc"}}],"predicateType":"slsaprovenance0_2","predicate":{"builder":{"id":"https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v2.0.0"},"build_type":"https://github.com/slsa-framework/slsa-github-generator/generic@v1","invocation":{"config_source":{"uri":"git+https://gi.....
....

This is done because sigstore-python only verifies the subjects of the DSSE envelope match the artifacts being verified, it does not do any verification on the predicate of the statement. This should be done by the user, which is why we print the statement after verification succeeds, so that the user has easy access to it.

Release Note

  • CLI: The sigstore verify command now outputs the inner in-toto statement
    when verifying DSSE envelopes. If verification is successful, the output
    will be "OK: $FILENAME" followed by the inner in-toto statement. This allows
    the user to see the statement's predicate, which sigstore-python does not
    verify and should be verified by the user.

cc @woodruffw

Signed-off-by: Facundo Tuesca <facundo.tuesca@trailofbits.com>
sigstore/_cli.py Outdated
@@ -811,8 +811,10 @@ def _verify_identity(args: argparse.Namespace) -> None:
)

try:
_verify_common(verifier, hashed, bundle, policy_)
statement = _verify_common(verifier, hashed, bundle, policy_)
print(f"OK: {file}")
Copy link
Member

Choose a reason for hiding this comment

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

Let's move this to stderr:

Suggested change
print(f"OK: {file}")
print(f"OK: {file}", file=sys.stderr)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated

* CLI: The `sigstore verify` command now outputs the inner in-toto statement
when verifying DSSE envelopes. If verification is successful, the output
will be "OK: $FILENAME" followed by the inner in-toto statement. This allows
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think we can remove this part, since OK: will be on stderr now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@woodruffw
Copy link
Member

Thanks @facutuesca, looks good! Just a few small comments.

@woodruffw woodruffw added component:cli CLI components component:verification Core verification functionality labels Sep 10, 2024
facutuesca and others added 2 commits September 10, 2024 19:45
Co-authored-by: William Woodruff <william@yossarian.net>
Signed-off-by: Facundo Tuesca <facu@tuesca.com>
Signed-off-by: Facundo Tuesca <facundo.tuesca@trailofbits.com>
@woodruffw
Copy link
Member

/gcbrun

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

Thanks @facutuesca, nice work!

@woodruffw woodruffw merged commit 1755bcc into sigstore:main Sep 10, 2024
23 checks passed
@woodruffw woodruffw deleted the verify-dsse-print-stmt branch September 10, 2024 17:53
@woodruffw woodruffw mentioned this pull request Sep 18, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli CLI components component:verification Core verification functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants