Skip to content

Add release atteststions #343

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
orf opened this issue Oct 8, 2024 · 15 comments · Fixed by #481 · May be fixed by #371
Closed

Add release atteststions #343

orf opened this issue Oct 8, 2024 · 15 comments · Fixed by #481 · May be fixed by #371
Labels
enhancement New feature or request

Comments

@orf
Copy link
Contributor

orf commented Oct 8, 2024

Hello!

First, thanks for this fantastic project - it’s a great help to the community and ecosystem at large.

I would like to suggest adding artifact attestations to the releases.

This would enable supply chain verification for these builds, and provide a layer of validation above just verifying the signature.

it’s pretty simple to add: just a single step, with no configuration or changes required in the binary itself.

what do you think?

@zanieb
Copy link
Member

zanieb commented Oct 8, 2024

Yeah these seem reasonable, were you interested in contributing this?

@orf
Copy link
Contributor Author

orf commented Oct 8, 2024 via email

orf added a commit to orf/python-build-standalone that referenced this issue Oct 16, 2024
@chludwig-haufe
Copy link

I see there is an open PR #371, but no further activity. Is there anything blocking the creation of the attestations?

Since I didn't see this mentioned in the documentation: How is the integrity of the Python sources and dependencies used in the build verified?

@indygreg
Copy link
Collaborator

We pin and verify the sha256 and file size of all downloaded assets. See downloads.py.

@zanieb
Copy link
Member

zanieb commented Dec 16, 2024

@chludwig-haufe there's a blocking comment at #371 (comment)

@orf
Copy link
Contributor Author

orf commented Dec 16, 2024

@chludwig-haufe there's a blocking comment at #371 (comment)

Yep! I have this PR in my backlog, but some personal stuff has come up.

We should indeed only attest on main (or anything that actually publishes), adding the relevant if: blocks should be all that is needed.

@charliermarsh charliermarsh added the enhancement New feature or request label Dec 18, 2024
zanieb added a commit that referenced this issue Jan 10, 2025
Follow up on feedback from #371 and the previous work from @orf which I
cherry-picked.

This adds build attestations for the builds using
[actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).

Closes #343

### Test Plan

Did a trial CI run which results in attestations like below for
`cpython-3.10-aarch64-unknown-linux-gnu-lto`

*
https://github.com/samypr100/python-build-standalone/attestations/4246020
* https://search.sigstore.dev/?logIndex=160192732

Co-authored-by: Thomas Forbes <tom.forbes@gitguardian.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
@zanieb
Copy link
Member

zanieb commented Jan 15, 2025

I presume we need to attest the artifacts in .github/workflows/release.yml too? We create several derived artifacts.

@chludwig-haufe
Copy link

Please pardon my ignorance (I am not an active user of GitHub actions) – but Verifying artifact attestations with the GitHub CLI made me assume I could verify the integrity of a downloaded package as follows:

$ curl -LO https://github.com/astral-sh/python-build-standalone/releases/download/20250115/cpython-3.10.16+20250115-aarch64-apple-darwin-install_only.tar.gz
$ export GH_TOKEN="GitHub personal access token w/ read privileges"
$ gh attestation verify cpython-3.10.16+20250115-aarch64-apple-darwin-install_only.tar.gz -R astral-sh/python-build-standalone
Loaded digest sha256:21dba90e7a0b879fdc475411fc8c39e0567c6f5c92112956b63de7f83ee433ad for file://cpython-3.10.16+20250115-aarch64-apple-darwin-install_only.tar.gz
✗ Loading attestations from GitHub API failed

Error: failed to fetch attestations from astral-sh/python-build-standalone: HTTP 404: Not Found (https://api.github.com/repos/astral-sh/python-build-standalone/attestations/sha256:21dba90e7a0b879fdc475411fc8c39e0567c6f5c92112956b63de7f83ee433ad?per_page=30)

What am I missing?

@zanieb
Copy link
Member

zanieb commented Jan 17, 2025

The -install_only archives are derived, as I mentioned in #343 (comment)

@zanieb zanieb reopened this Jan 17, 2025
@zanieb
Copy link
Member

zanieb commented Jan 17, 2025

Let's just re-open this until we reach a point where these are validated as functional. cc @samypr100

@chludwig-haufe
Copy link

The -install_only archives are derived, as I mentioned in #343 (comment)

Ah, I didn't make the connection that your comment referred to installable packages, too. I had assumed you meant SBOMs and similar metadata. (I am obviously not familiar with your build pipeline.) Thanks for the clarification.

@chludwig-haufe
Copy link

I can verify, e..g., cpython-3.10.16+20250115-aarch64-apple-darwin-pgo+lto-full.tar.zst.
On the other hand, the verification of cpython-3.10.16+20250115-aarch64-unknown-linux-gnu-lto-full.tar.zst fails with a 404.

Looking at .github/workflows/linux.yml, I suspect the former artifact is generated by build-1 and the latter by build-0: build-1 includes a "Generate Attestation" step in line 326, whereas build-0 has no such step.

zanieb pushed a commit that referenced this issue Jan 28, 2025
Per
#343 (comment)

* Adds attestations to build-0 of the linux matrix (due to recent
refactor)
* Adds attestations to release artifacts which include install only
derived builds.
@zanieb zanieb mentioned this issue Jan 30, 2025
@samypr100
Copy link
Contributor

@chludwig-haufe can you try again on the latest release?

@chludwig-haufe
Copy link

chludwig-haufe commented Feb 14, 2025

I downloaded and successfully verified all(?) 564 artifacts matching the shell pattern cpython*.tar.{gz,zst} - looks good!

Thanks!

@zanieb
Copy link
Member

zanieb commented Feb 14, 2025

Thank you!

@zanieb zanieb closed this as completed Feb 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
6 participants