Skip to content

Navigation Menu

Sign up
sigstorePublic

About

A codesigning tool for Python packages

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

341 stars

Watchers

7 watching

Forks

Repository files navigation

sigstore-python

CI PyPI version OpenSSF Scorecard SLSA Conformance Tests Documentation

sigstore is a Python tool for generating and verifying Sigstore signatures. You can use it to sign and verify Python package distributions, or anything else!

Index

Features

Installation

sigstore requires Python 3.11 or newer, and can be installed directly via pip:

python -m pip install sigstore

See the installation page in the documentation for more installation options.

Usage

For Python API usage, see our API.

You can run sigstore as a standalone program:

sigstore --help

Top-level:

usage: sigstore [-h] [-v] [-V]
 [--staging | --instance URL | --trust-config FILE]
 COMMAND ...
a tool for signing and verifying Python package distributions
positional arguments:
 COMMAND the operation to perform
 attest sign one or more inputs using DSSE
 sign sign one or more inputs
 verify verify one or more inputs
 get-identity-token
 retrieve and return a Sigstore-compatible OpenID
 Connect token
 trust-instance Initialize trust for a Sigstore instance
 plumbing developer-only plumbing operations
options:
 -h, --help show this help message and exit
 -v, --verbose run with additional debug logging; supply multiple
 times to increase verbosity (default: 0)
 -V, --version show program's version number and exit
 --staging Use sigstore's staging instance, instead of the default
 production instance. Mutually exclusive with other
 instance configuration arguments. (default: False)
 --instance URL Use a given Sigstore instance URL, instead of the
 default production instance. Mutually exclusive with
 other instance configuration arguments. (default: None)
 --trust-config FILE Use given client trust configuration instead of using
 the default production instance. Mutually exclusive
 with other instance configuration arguments. (default:
 None)

Signing

usage: sigstore sign [-h] [-v] [--rekor-version VERSION]
 [--identity-token TOKEN] [--oidc-client-id ID]
 [--oidc-client-secret SECRET]
 [--oidc-disable-ambient-providers] [--oidc-issuer URL]
 [--oauth-force-oob] [--no-default-files]
 [--signature FILE] [--certificate FILE] [--bundle FILE]
 [--output-directory DIR] [--overwrite]
 FILE [FILE ...]
positional arguments:
 FILE The file to sign
options:
 -h, --help show this help message and exit
 -v, --verbose run with additional debug logging; supply multiple
 times to increase verbosity (default: 0)
 --rekor-version VERSION
 Force the rekor transparency log version. Valid values
 are [1, 2]. By default the highest available version
 is used
OpenID Connect options:
 --identity-token TOKEN
 the OIDC identity token to use (default: None)
 --oidc-client-id ID The custom OpenID Connect client ID to use during
 OAuth2 (default: sigstore)
 --oidc-client-secret SECRET
 The custom OpenID Connect client secret to use during
 OAuth2 (default: None)
 --oidc-disable-ambient-providers
 Disable ambient OpenID Connect credential detection
 (e.g. on GitHub Actions) (default: False)
 --oidc-issuer URL The OpenID Connect issuer to use (default: None)
 --oauth-force-oob Force an out-of-band OAuth flow and do not
 automatically start the default web browser (default:
 False)
Output options:
 --no-default-files Don't emit the default output files
 ({input}.sigstore.json) (default: False)
 --signature FILE, --output-signature FILE
 Write a single signature to the given file; does not
 work with multiple input files (default: None)
 --certificate FILE, --output-certificate FILE
 Write a single certificate to the given file; does not
 work with multiple input files (default: None)
 --bundle FILE Write a single Sigstore bundle to the given file; does
 not work with multiple input files (default: None)
 --output-directory DIR
 Write default outputs to the given directory
 (conflicts with --signature, --certificate, --bundle)
 (default: None)
 --overwrite Overwrite preexisting signature and certificate
 outputs, if present (default: False)

Signing with DSSE envelopes

usage: sigstore attest [-h] [-v] [--rekor-version VERSION] --predicate FILE
 --predicate-type TYPE [--identity-token TOKEN]
 [--oidc-client-id ID] [--oidc-client-secret SECRET]
 [--oidc-disable-ambient-providers] [--oidc-issuer URL]
 [--oauth-force-oob] [--bundle FILE] [--overwrite]
 FILE [FILE ...]
positional arguments:
 FILE The file to sign
options:
 -h, --help show this help message and exit
 -v, --verbose run with additional debug logging; supply multiple
 times to increase verbosity (default: 0)
 --rekor-version VERSION
 Force the rekor transparency log version. Valid values
 are [1, 2]. By default the highest available version
 is used
DSSE options:
 --predicate FILE Path to the predicate file (default: None)
 --predicate-type TYPE
 Specify a predicate type
 (https://slsa.dev/provenance/v0.2,
 https://slsa.dev/provenance/v1) (default: None)
OpenID Connect options:
 --identity-token TOKEN
 the OIDC identity token to use (default: None)
 --oidc-client-id ID The custom OpenID Connect client ID to use during
 OAuth2 (default: sigstore)
 --oidc-client-secret SECRET
 The custom OpenID Connect client secret to use during
 OAuth2 (default: None)
 --oidc-disable-ambient-providers
 Disable ambient OpenID Connect credential detection
 (e.g. on GitHub Actions) (default: False)
 --oidc-issuer URL The OpenID Connect issuer to use (default: None)
 --oauth-force-oob Force an out-of-band OAuth flow and do not
 automatically start the default web browser (default:
 False)
Output options:
 --bundle FILE Write a single Sigstore bundle to the given file; does
 not work with multiple input files (default: None)
 --overwrite Overwrite preexisting bundle outputs, if present
 (default: False)

Verifying

Identities

usage: sigstore verify identity [-h] [-v] [--certificate FILE]
 [--signature FILE] [--bundle FILE] [--offline]
 --cert-identity IDENTITY --cert-oidc-issuer
 URL
 FILE_OR_DIGEST [FILE_OR_DIGEST ...]
options:
 -h, --help show this help message and exit
 -v, --verbose run with additional debug logging; supply multiple
 times to increase verbosity (default: 0)
Verification inputs:
 --certificate FILE, --cert FILE
 The PEM-encoded certificate to verify against; not
 used with multiple inputs (default: None)
 --signature FILE The signature to verify against; not used with
 multiple inputs (default: None)
 --bundle FILE The Sigstore bundle to verify with; not used with
 multiple inputs (default: None)
 FILE_OR_DIGEST The file path or the digest to verify. The digest
 should start with the 'sha256:' prefix.
Verification options:
 --offline Perform offline verification; requires a Sigstore
 bundle (default: False)
 --cert-identity IDENTITY
 The identity to check for in the certificate's Subject
 Alternative Name (default: None)
 --cert-oidc-issuer URL
 The OIDC issuer URL to check for in the certificate's
 OIDC issuer extension (default: None)

Signatures from GitHub Actions

usage: sigstore verify github [-h] [-v] [--certificate FILE]
 [--signature FILE] [--bundle FILE] [--offline]
 [--cert-identity IDENTITY] [--trigger EVENT]
 [--sha SHA] [--name NAME] [--repository REPO]
 [--ref REF]
 FILE_OR_DIGEST [FILE_OR_DIGEST ...]
options:
 -h, --help show this help message and exit
 -v, --verbose run with additional debug logging; supply multiple
 times to increase verbosity (default: 0)
Verification inputs:
 --certificate FILE, --cert FILE
 The PEM-encoded certificate to verify against; not
 used with multiple inputs (default: None)
 --signature FILE The signature to verify against; not used with
 multiple inputs (default: None)
 --bundle FILE The Sigstore bundle to verify with; not used with
 multiple inputs (default: None)
 FILE_OR_DIGEST The file path or the digest to verify. The digest
 should start with the 'sha256:' prefix.
Verification options:
 --offline Perform offline verification; requires a Sigstore
 bundle (default: False)
 --cert-identity IDENTITY
 The identity to check for in the certificate's Subject
 Alternative Name (default: None)
 --trigger EVENT The GitHub Actions event name that triggered the
 workflow (default: None)
 --sha SHA The `git` commit SHA that the workflow run was invoked
 with (default: None)
 --name NAME The name of the workflow that was triggered (default:
 None)
 --repository REPO The repository slug that the workflow was triggered
 under (default: None)
 --ref REF The `git` ref that the workflow was invoked with
 (default: None)

Troubleshooting

First, please make sure you are using a recent and supported release: sigstore-python project provides support for the latest release and best effort critical bug fixes for the latest 3.6.x release.

Common issues

  1. "bundle contains a transparency log entry that is incompatible with this version of sigstore-python" (as well as "not enough sources of verified time") means an upgrade is necessary to verify this signature bundle: Signature bundles with Rekor v2 transparency log entries can only be verified with sigstore-python 4 and above
  2. verifying without a network connection results in HTTP errors: By default sigstore-python checks for updates to the trusted key material on every startup. This can be avoided temporarily with --offline but please read the documentation for caveats
  3. Signing results in HTTP errors: Signing with sigstore-python depends on multiple Sigstore services. Retrying on failure may be a useful workaround if any of these services fail but filing issues for specific failures is appreciated

My problem is something else

Please open an issue or ask in the slack channel.

Documentation

sigstore documentation is available on https://sigstore.github.io/sigstore-python

Licensing

sigstore is licensed under the Apache 2.0 License.

Community

sigstore-python is developed as part of the Sigstore project.

We also use a Slack channel! Click here for the invite link.

Contributing

See the contributing docs for details.

Code of Conduct

Everyone interacting with this project is expected to follow the sigstore Code of Conduct.

Security

Should you discover any security issues, please refer to sigstore's security process.

About

A codesigning tool for Python packages

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

341 stars

Watchers

7 watching

Forks

Releases

Used by

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /