Code Monkey home page Code Monkey logo

sigstore-python's Introduction

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.8 or newer, and can be installed directly via pip:

python -m pip install sigstore

Optionally, to install sigstore and all its dependencies with hash-checking mode enabled, run the following:

python -m pip install -r https://raw.githubusercontent.com/sigstore/sigstore-python/main/install/requirements.txt

This installs the requirements file located here, which is kept up-to-date.

GitHub Actions

sigstore-python has an official GitHub Action!

You can install it from the GitHub Marketplace, or add it to your CI manually:

jobs:
  sigstore-python:
    steps:
      - uses: sigstore/[email protected]
        with:
          inputs: foo.txt

See the action documentation for more details and usage examples.

Usage

For Python API usage, see our documentation.

You can run sigstore as a standalone program, or via python -m:

sigstore --help
python -m sigstore --help

Top-level:

usage: sigstore [-h] [-v] [-V] [--staging | --trust-config FILE] COMMAND ...

a tool for signing and verifying Python package distributions

positional arguments:
  COMMAND              the operation to perform
    sign               sign one or more inputs
    verify             verify one or more inputs
    get-identity-token
                       retrieve and return a Sigstore-compatible OpenID
                       Connect token

optional arguments:
  -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 instances, instead of the
                       default production instances (default: False)
  --trust-config FILE  The client trust configuration to use (default: None)

Signing

usage: sigstore sign [-h] [-v] [--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

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         run with additional debug logging; supply multiple
                        times to increase verbosity (default: 0)

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 (conflicts with
                        --staging) (default: https://oauth2.sigstore.dev/auth)
  --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)

Verifying

Generic identities

This is the most common verification done with sigstore, and therefore the one you probably want: you can use it to verify that a signature was produced by a particular identity (like [email protected]), as attested to by a particular OIDC provider (like https://github.com/login/oauth).

usage: sigstore verify identity [-h] [-v] [--certificate FILE]
                                [--signature FILE] [--bundle FILE] [--offline]
                                --cert-identity IDENTITY --cert-oidc-issuer
                                URL
                                FILE [FILE ...]

optional arguments:
  -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                  The file to verify

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

If your signatures are coming from GitHub Actions (e.g., a workflow that uses its ambient credentials), then you can use the sigstore verify github subcommand to verify claims more precisely than sigstore verify identity allows:

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 [FILE ...]

optional arguments:
  -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                  The file to verify

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)

Advanced usage

Configuring a custom root of trust ("BYO PKI")

Apart from the default and "staging" Sigstore instances, sigstore also supports "BYO PKI" setups, where a user maintains their own Sigstore instance services.

These are supported via the --trust-config flag, which accepts a JSON-formatted file conforming to the ClientTrustConfig message in the Sigstore protobuf specs. This file configures the entire Sigstore instance state, including the URIs used to access the CA and artifact transparency services as well as the cryptographic root of trust itself.

To use a custom client config, prepend --trust-config to any sigstore command:

$ sigstore --trust-config custom.trustconfig.json sign foo.txt
$ sigstore --trust-config custom.trustconfig.json verify identity foo.txt ...

Example uses

sigstore supports a wide variety of workflows and usages. Some common ones are provided below.

Signing with ambient credentials

For environments that support OpenID Connect, natively sigstore supports ambient credential detection. This includes many popular CI platforms and cloud providers. See the full list of supported environments here.

Sign a single file (foo.txt) using an ambient OpenID Connect credential, saving the bundle to foo.txt.sigstore:

$ python -m sigstore sign foo.txt

Signing with an email identity

sigstore can use an OAuth2 + OpenID flow to establish an email identity, allowing you to request signing certificates that attest to control over that email.

Sign a single file (foo.txt) using the OAuth2 flow, saving the bundle to foo.txt.sigstore:

$ python -m sigstore sign foo.txt

By default, sigstore attempts to do ambient credential detection, which may preempt the OAuth2 flow. To force the OAuth2 flow, you can explicitly disable ambient detection:

$ python -m sigstore sign --oidc-disable-ambient-providers foo.txt

Signing with an explicit identity token

If you can't use an ambient credential or the OAuth2 flow, you can pass a pre-created identity token directly into sigstore sign:

$ python -m sigstore sign --identity-token YOUR-LONG-JWT-HERE foo.txt

Note that passing a custom identity token does not circumvent Fulcio's requirements, namely the Fulcio's supported identity providers and the claims expected within the token.

Verifying against a signature and certificate

By default, sigstore verify identity will attempt to find a <filename>.sigstore in the same directory as the file being verified:

# looks for foo.txt.sigstore
$ python -m sigstore verify identity foo.txt \
    --cert-identity '[email protected]' \
    --cert-oidc-issuer 'https://github.com/login/oauth'

Multiple files can be verified at once:

# looks for {foo,bar}.txt.sigstore
$ python -m sigstore verify identity foo.txt bar.txt \
    --cert-identity '[email protected]' \
    --cert-oidc-issuer 'https://github.com/login/oauth'

Verifying signatures from GitHub Actions

sigstore verify github can be used to verify claims specific to signatures coming from GitHub Actions. sigstore-python signs releases via GitHub Actions, so the examples below are working examples of how you can verify a given sigstore-python release.

When using sigstore verify github, you must pass --cert-identity or --repository, or both. Unlike sigstore verify identity, --cert-oidc-issuer is not required (since it's inferred to be GitHub Actions).

Verifying with --cert-identity:

$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
    --bundle sigstore-0.10.0-py3-none-any.whl.bundle \
    --cert-identity https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/v0.10.0

Verifying with --repository:

$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
    --bundle sigstore-0.10.0-py3-none-any.whl.bundle \
    --repository sigstore/sigstore-python

Additional GitHub Actions specific claims can be verified like so:

$ python -m sigstore verify github sigstore-0.10.0-py3-none-any.whl \
    --bundle sigstore-0.10.0-py3-none-any.whl.bundle \
    --cert-identity https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/v0.10.0 \
    --trigger release \
    --sha 66581529803929c3ccc45334632ccd90f06e0de4 \
    --name Release \
    --repository sigstore/sigstore-python \
    --ref refs/tags/v0.10.0

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.

SLSA Provenance

This project emits a SLSA provenance on its release! This enables you to verify the integrity of the downloaded artifacts and ensured that the binary's code really comes from this source code.

To do so, please follow the instructions here.

sigstore-python's People

Contributors

ankenyr avatar asraa avatar azeemshaikh38 avatar bobcallaway avatar ccordoui avatar david-a-wheeler avatar dependabot[bot] avatar di avatar diogoteles08 avatar emilejbm avatar facutuesca avatar github-actions[bot] avatar haydentherapper avatar javanlacerda avatar jku avatar jleightcap avatar kurtmckee avatar laurentsimon avatar lukehinds avatar mayacostantini avatar perone avatar sethmlarson avatar step-security-bot avatar tetsuo-cpp avatar tnytown avatar uranusjr avatar wallies avatar woodruffw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sigstore-python's Issues

OAuth flow: intermittent 400 errors

Description

When running sigstore locally with the OAuth OIDC flow, I occasionally get HTTP 400s. Happens with both sigstore.dev and sigstage.dev as the instance. The error code indicates that it's almost certainly a payload construction error on our side, possibly due to raciness when setting up the local HTTP listener.

Example invocation:

$ sigstore sign README.md

Example traceback:

BUG:urllib3.connectionpool:https://oauth2.sigstage.dev:443 "POST /auth/token HTTP/1.1" 400 70
Traceback (most recent call last):
  File "/Users/william/devel/sigstore-python/sigstore/_internal/oidc/oauth.py", line 193, in get_identity_token
    resp.raise_for_status()
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://oauth2.sigstage.dev/auth/token

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/william/devel/sigstore-python/env/bin/sigstore", line 8, in <module>
    sys.exit(main())
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/william/devel/sigstore-python/sigstore/_cli.py", line 110, in _sign
    identity_token = get_identity_token(
  File "/Users/william/devel/sigstore-python/sigstore/_internal/oidc/oauth.py", line 195, in get_identity_token
    raise IdentityError from http_error
sigstore._internal.oidc.IdentityError

Release: sign via ambient credentials

Description

Once this library supports ambient credential detection in #31, we should update our release workflow to sign via GitHub's ambient OIDC identity instead of explicitly requesting it.

Blocked on #31.

Keep a CHANGELOG

Once we get to (or close to) a stable release, we should begin to keep a CHANGELOG.

Implement Fulcio client API

In order to implement signing, we need to write a Python client to interact with Fulcio. We need to write this in a generic way so that other programs can use pysign's Fulcio client for their own purposes.

Dogfood verification

I'm not a complete beginner and I still have trouble understanding what exactly I can actually verify with sigstore-python at the moment... It would be helpful if there was an example in the documentation of verifying e.g. that a sigstore-python release was actually built by the github action of the project.

The status at the moment seems to be:

  • certificate and signature could easily be published along the artifacts (since sign --output-* options were just added) but currently they are not published
  • There is a somewhat undocumented verify --cert-email option that seems to be what I want, just slightly badly named: it looks like it would allow me to check that SAN contains URI:https://github.com/sigstore/sigstore-python/.github/workflows/release.yml@refs/tags/$VERSION
  • I imagine in addition to SAN I should verify that the signing key is a github key? Is there a process for this or should the verifying script just hardcode the keyid? Should there be an option in verify for this?

I'd really like to use sigstore-python for this exact purpose so I'm willing to do some work here but I think I need a bit of guidance at least: Is my understanding of how to verify that build artifacts were built by a specific github action correct? Am I missing anything with regards to my last bullet point: how do I verify that the cert actually comes from GitHub?

Finalize importable `sigstore` API

Once we've written the Fulcio and Rekor clients, we should be fill out the importable API. The API should roughly line up with the subcommands that cosign supports.

The CLI itself (which we'll implement in #3) will be a thin wrapper that wires the argparse flags to the API. So the meat of the CLI logic will be covered in this task.

I expect that we'll separate this into multiple issues when we begin working on it.

Tighter update loop for hashed requirements file

In #114 @woodruffw raised that this file may become stale on new releases.

To resolve this and provide a tighter feedback loop on a release -> update, we could

`--output-signature` and `--output-certificate` flags are greedy

Description

When trying to use the --output-* flags with default values, invocation fails because they try to consume the filename of the artifact to be signed:

$ python -m sigstore sign --output-signature --output-certificate hi.txt
Usage: python -m sigstore sign [OPTIONS] FILE [FILE ...]
Try 'python -m sigstore sign --help' for help.

Error: Missing argument 'FILE [FILE ...]'.

Implement `sigstore` CLI

Once we've implemented the sigstore API, we can write a CLI wrapper to call into it with various flags.

We should aim for CLI compatibility with cosign where applicable.

Add `--staging` convenience flag

Testing against the staging instances of Fulcio, Rekor, Sigstore OIDC provider, etc will be a common use case so we should have a --staging flag that sets --fulcio-url, --rekor-url and --oidc-provider as appropriate.

Let's leave this until after #27 since we haven't exposed --rekor-url yet.

Implement SCT verification

This doesn't seem to exist in pyca/cryptography. We should check whether there's another library that includes this functionality. If not, we might need to hand-roll it ourselves.

Known issue: `KeyError: 'sct'`

Description

When signing, the following exception is displayed:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sigstore/_internal/fulcio/client.py", line 233, in post
    sct = FulcioSignedCertificateTimestamp(resp.headers["SCT"])
  File "/usr/local/lib/python3.10/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'sct'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/site-packages/sigstore/__main__.py", line 22, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/sigstore/_cli.py", line 119, in _sign
    result = sign(
  File "/usr/local/lib/python3.10/site-packages/sigstore/_sign.py", line 102, in sign
    certificate_response = fulcio.signing_cert.post(certificate_request, identity_token)
  File "/usr/local/lib/python3.10/site-packages/sigstore/_internal/fulcio/client.py", line 236, in post
    raise FulcioClientError from exc
sigstore._internal.fulcio.client.FulcioClientError

Version

This affects all currently published versions of sigstore.

Fix

This is blocked on a release that includes #84.

X509StoreContextError: unable to get local issuer certificate

I noticed this exception raised when running verification:

Traceback (most recent call last):
  File "/Users/tetsuo/Code/sigstore-python/env/bin/sigstore", line 8, in <module>
    sys.exit(main())
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/tetsuo/Code/sigstore-python/sigstore/_cli.py", line 299, in _verify
    if verify(
  File "/Users/tetsuo/Code/sigstore-python/sigstore/_verify.py", line 128, in verify
    store_ctx.verify_certificate()
  File "/Users/tetsuo/Code/sigstore-python/env/lib/python3.9/site-packages/OpenSSL/crypto.py", line 1896, in verify_certificate
    raise self._exception_from_context()
OpenSSL.crypto.X509StoreContextError: [20, 0, 'unable to get local issuer certificate']

This is trivial to trigger for me. All I need to do is this:

$ sigstore sign test_file.txt --output-signature --output-certificate
$ sigstore verify test_file.txt --cert test_file.txt.crt --signature test_file.txt.sig

From looking around, the error seems to indicate that we might need to pass the entire certificate chain into verification.

Ambient detection: overzealous error during GCP detection

We currently fail rather than returning None if the virtualization product's ID isn't what we expect, which causes problems for e.g. Docker containers:

sigstore._internal.oidc.ambient.AmbientCredentialError: GCP: product name file exists, but product name is 'BHYVE'; giving up

Retrieve CTFE signing key via TUF

At the moment, we've decided to check in the CTFE public key and use it to verify SCTs. The way this should really work is that we should check in the root key (root.json) and use it to download the CTFE key via TUF.

Security Policy violation Outside Collaborators

This issue was automatically created by Allstar.

Security Policy Violation
Found 3 outside collaborators with admin access.
This policy requires all users with this access to be members of the organisation. That way you can easily audit who has access to your repo, and if an account is compromised it can quickly be denied access to organization resources. To fix this you should either remove the user from repository-based access, or add them to the organization.

OR

If you don't see the Settings tab you probably don't have administrative access. Reach out to the administrators of the organisation to fix this issue.


This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Create API stubs

Create basic package structure and empty modules so that we can begin collaborating.

Implement Rekor client API

In order to implement uploading/verifying of signatures, we need to write a Python client to interact with Rekor. We need to write this in a generic way so that other programs can use pysign's Rekor client for their own purposes.

Define a "verification configuration bundle"

Description

I'd like to explore a format for a "verification configuration bundle". This would be:

  • a single human-readable file (probably JSON)
  • with a specific extension (like .sigstore)
  • that includes the verification materials for one or more signatures for one or more artifacts (likely keyed by SHA256 hash)
  • as well as configuration for additional extension verification

So for #106, this could be something like:

{
  "config": {
    "cert-oidc-issuer": "https://token.actions.githubusercontent.com",
    ...
    "<some other extension>": "<some other value>"
  },
  "artifacts": {
    "<sha256 hash>": {
      "bundles": [
        {
          "sig": "<signature>"
          "crt": "<base64 encoded certificate>"
        },
        ...
        <potentially additional signatures>
     ]
    },
    "<another sha256 hash>": {
        <same as above>
    }
  }
}  

Which would be used like:

# For multiple artifacts:
$ python -m sigstore verify <something>.sigstore artifacts_to_verify/*

# Same bundle, but works for a single artifact:
$ python -m sigstore verify <something>.sigstore artifacts_to_verify/artifact.ext

Some open questions:

  • What should the name of this file be, if it signs multiple artifacts?
  • Should the "additional verification" be across all artifacts, or specific to individual artifacts? Or just potentially override-able?
  • How would a user create/edit this file with a sigstore client?

Reenable interrogate

As part of #12, we've disabled interrogate while we're in the initial phases of development. When things are looking more solid, let's add a docstring for everything and reenable interrogate.

Warn when verification materials will be overwritten

Description

Before the signing process is invoked, we should warn (or perhaps refuse to sign / output verification materials) if the sign will overwrite existing files with the new verification materials.

We could possibly, additionally, provide a flag that permits the overwrite.

Support ambient credential detection

Cosign supports 'ambient credential detection' for a number of environments where OIDC identities are available by default. We should also similarly support:

See also https://dlorenc.medium.com/a-bit-of-ambiance-comes-to-sigstore-f80d1d6b1c30

This issue is tracking support for SaaS products and not self-hosted instances, e.g. GitLab's hosted product and not their on-premise or self-hosted services. Self-hosted services are out-of-scope, pending further discussion with Fulcio.

Support writing signature and certificate to files

Description

We should support the ability to write the certificate and signature(s) to files.

Cosign does this via --output-certificate and --output-signature:

$ COSIGN_EXPERIMENTAL=1 cosign sign-blob --help
Sign the supplied blob, outputting the base64-encoded signature to stdout.

...

      --output-certificate string                write the certificate to FILE
      --output-signature string                  write the signature to FILE

...

Bandit scanning

If you folks would like we could bring Bandit into CI. I am maintainer over there if we needed anything in particular. We should not feel obliged though, whatever you all see as fitting.

Support globs for filenames

Similar to cosign, this library should support passing globs as filenames. Currently, it fails:

$ sigstore sign --identity-token=$(...) dist/*
Usage: sigstore sign [OPTIONS] FILE
Try 'sigstore sign --help' for help.

Error: Invalid value for 'FILE': 'dist/*': No such file or directory

Support other signature and hash types

We have some hardcoded assumptions that we're using ECDSA keys with SHA256 hashes to generate signatures. Fulcio supports other signing and hashing algorithms so we should allow them too. For example, the staging instance is currently using an RSA CTFE key for signing.

Support verifying offline Rekor bundles

Description

As described in the specification, a Rekor response can be stored and verified without hitting the log. The client should:

  • Verify the SET
  • Verify that the signature over the blob matches what's in the payload's body
  • Compare the integrated time against the certificate
  • Compare hashes of the Rekor payload body to the provided blob

See code in Cosign for more details.

Evaluate dependencies

Figure out what dependencies we're going to need to implement the pysign API.

  • Fulcio and Rekor seem to expose a REST API so requests should cover that.
  • Creating key pairs and using them to sign packages could be interesting. pyca/cryptography looks like it could be a good candidate.

CI: Use a discrete deployment environment for releases

We should do the same thing pip-audit does. We might want to hold off on it until the repository is migrated, however.

Now that we have an automated release workflow, we should constraint it to a custom environment to take advantage of more robust secret management.

Populate README

We should populate the README with an explanation of what this repo is and provide some CLI usage examples.

Bring up our coverage and reenable coverage testing

We've temporarily disabled coverage testing while we're fleshing out the basic signing/verification functionality. Once things take a bit more shape, we should begin adding back coverage.

I expect this issue to be broken up into smaller PRs to test each module separately since there's probably quite a lot of work to do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.