sigstore / sigstore-python

A Sigstore client written in Python
https://pypi.org/p/sigstore
Other
233 stars 49 forks source link

Add `sigstore attest` CLI subcommand to sign using DSSE envelopes #1115

Closed facutuesca closed 2 months ago

facutuesca commented 2 months ago

Summary

Part of https://github.com/sigstore/sigstore-python/issues/1111. Adds a sigstore attest CLI subcommand to sign using DSSE. The command is very similar to sigstore sign, but it takes two new options:

sigstore attest --predicate-type https://slsa.dev/provenance/v0.2 --predicate ./path/to/predicate.json  FILE

Since the logic for both sigstore sign and sigstore attest is mostly the same, this PR extracts that shared logic into a separate function _sign_common(), which is then called by _sign() and _attest() in order to not duplicate that logic.

In order to test it, I have uploaded a SLSA v0.2 provenance predicate here, originally generated by GitHub for this sigstore-python release. Once downloaded, it can be used to sign over a file with the following command:

sigstore attest --predicate-type https://slsa.dev/provenance/v0.2 --predicate ./path/to/predicate.json  FILE

Release Note

Documentation

Updated the README

cc @woodruffw

woodruffw commented 2 months ago

/gcbrun

woodruffw commented 2 months ago

/gcbrun

woodruffw commented 2 months ago

/gcbrun

woodruffw commented 2 months ago

/gcbrun

woodruffw commented 2 months ago

/gcbrun