Skip to content

Difficulties with pypi_attestations verify #55

@AA-Turner

Description

@AA-Turner

Hi,

I'm looking to use PEP 740 attestations in Sphinx, using the pypi_attestations CLI. The signing and inspection steps seem to work, but I've had some trouble with verify. Hopefully there's an opportunity to improve documenation or guidance:

  1. Running verify dist/*.publish.attestation fails with an unhelpful error. This was my first approach, as I wanted to run sign-inspect-verify consecutively in GHA, and the inspect command runs on .publish.attestation files. Similarly, running verify dist/* fails with the same error -- perhaps the tool could check if the extension is already .publish.attestation, and if so skip that file?

    $ python -m pypi_attestations verify dist/*.publish.attestation --identity ...
    dist/sphinx-8.1.0-py3-none-any.whl.publish.attestation.publish.attestation is not a file.
    $ python -m pypi_attestations verify dist/* --identity ...
    dist/sphinx-8.1.0-py3-none-any.whl.publish.attestation.publish.attestation is not a file.
  2. pypi_attestations inspect doesn't tell me what value I should be using with --identity (I don't know if this is possible, though). The example on README uses an email, so I tried the email I use for commits, which failed.

  3. The failure for an incorrect --identity key is obscure and confusing ("Certificate's SANs do not match"):

    $ python -m pypi_attestations verify dist/*.whl --identity 9087854+aa-turner@users.noreply.github.com
    Verification failed for dist/sphinx-8.1.0-py3-none-any.whl: Verification failed: Certificate's SANs do not match 9087854+aa-turner@users.noreply.github.com; actual SANs: {'https://github.com/AA-Turner/sphinx/.github/workflows/create-release.yml@refs/heads/attestations'}
    Verification failed for dist/sphinx-8.1.0.tar.gz: Verification failed: Certificate's SANs do not match 9087854+aa-turner@users.noreply.github.com; actual SANs: {'https://github.com/AA-Turner/sphinx/.github/workflows/create-release.yml@refs/heads/attestations'}

    At the least expanding the initialism so that I can look up what a SAN is would be helpful. The key for "actual SANs" is a hyperlink, which doesn't look like the example of the verify command on the README.

  4. Failures to verify in CI don't exit with a non-zero status code, so GHA reports all is well -- this seems wrong.

  5. Using the "actual SAN" hyperlink as the value for --identity works, but it is unclear how to auto-generate this for verification purposes. Is it always <address of fork>/<path to workflow>@refs/heads/<branch name>? Is there a difference if annotated or lightweight git tags are used? I can find many of these things by trial-and-error, but the documentation of pypi_attestations verify in README doesn't mention it.

Sorry for the laundry list of problems, but I thought it would be helpful to list my experience here as attestations are still fairly new. If I've missed a very obvious source of documentation please forgive me -- I tried looking in e.g. https://docs.pypi.org/attestations/publish/v1 as listed in pypi_attestations inspect, but every part of that path is a 404.

Thanks,
Adam

P.S. For context, the Sphinx PR that lead to this is at sphinx-doc/sphinx#12981

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions