PyPI now supports digital attestations

(blog.pypi.org)

Comments

belval 10 hours ago
I have a bit of uneasiness about how this is heavily pushing GitHub actions as the correct way to publish to PyPI. I had to check PEP740 to make sure it was not directly supported by Microsoft.

> The generation and publication of attestations happens by default, and no changes are necessary for projects that meet all of these conditions: publish from GitHub Actions; via Trusted Publishing; and use the pypa/gh-action-pypi-publish action to publish.

If you then click on "The manual way" it adds a big disclaimer:

> STOP! You probably don't need this section; it exists only to provide some internal details about how attestation generation and uploading work. If you're an ordinary user, it is strongly recommended that you use one of the official workflows described above.

Where the only official workflow is "Use GitHub Actions".

I guess I am an idealist but as a maintainer this falls short of my expectations for the openness of Python and PyPI.

ris 4 hours ago
I'm not really convinced of the value of such attestations until a second party can reproduce the build themselves on their own hardware.

Putting aside the fact that the mechanisms underpinning Github Actions are a mystery black box, the vast vast vast majority of github workflows are not built in a reproducible way - it's not even something that's encouraged by Github Actions' architecture, which emphasises Actions' container images that are little more than packaged installer scripts that go and download dependencies from random parts of the internet at runtime. An "attestation" makes no guarantee that one of these randomly fetched dependencies hasn't been usurped.

This is not to go into the poor security record of Github Actions' permissions model, which has brought us all a number of "oh shit" moments.

ashvardanian 11 hours ago
Here is the GitHub issue you can subscribe to for automatically generated attestations in the GitHub CI PyPi upload action: https://github.com/pypa/gh-action-pypi-publish/issues/288
jonnycomputer 9 hours ago
Supply chain security is very important, and this seems like an important step. Seems absolutely essential that something like the Mozilla foundation, or EFF, or some other open-source friendly entity help provide such a service, instead of corralling users into companies with exploitative business models.

I am in no hurry to be pushed into using Github, Gitlab or whatever else. Programmer's open source code has been monetized by these companies to feed AI LLM beasties, and it's fundamentally objectionable to me. I self-host my code using Gitea for that reason.

SethMLarson 10 hours ago
Congratulations to everyone involved in this work! This is an incredible building block for not just supply-chain security both inside and downstream of the PyPI ecosystem but also for data analysis of open source projects (through strong linkage back to source repositories). Thank you all <3
pabs3 1 hour ago
Wonder when PyPI will be doing bootstrappable and reproducible builds.

https://bootstrappable.org/ https://reproducible-builds.org/

krnavy 10 hours ago
After 2FA, the previous PyPI buzzword that was forced on everyone, JFrog discovered a key leak that compromised everything:

https://news.ycombinator.com/item?id=40941809

JFrog also discovered multiple malicious package exploits later.

Now we get a Github centric new buzzword that could be replaced by trusted SHA256 sums. Python is also big on business speak like SBOM. The above key leak of course occurred after all these new security "experts" manifested themselves out of nowhere.

The procedure remains the same. Download a package from the original creators, audit it, use a local repo and block PyPI.

dlor 11 hours ago
This is awesome to see, and the result of many years of hard work from awesome people.
woodruffw 11 hours ago
I'm very excited this has come to fruition!

PyPI's user docs[1] have some more details, as does the underlying PEP[2].

[1]: https://docs.pypi.org/attestations/

[2]: https://peps.python.org/pep-0740/

antononcube 11 hours ago
It looks like another process certain software engineers want to program and facilitate. I hope it is and stays optional.
cpburns2009 11 hours ago
Great, now how do you use attestations with Twine when publishing packages on PyPI outside of the Github ecosystem?
trishankkarthik 11 hours ago
Very cool, and congrats!

The corresponding ToB blog post says the following:

> Longer term, we can do even better: doing “one off” verifications means that the client has no recollection of which identities should be trusted for which distributions. To address this, installation tools need a notion of “trust on first use” for signing identities, meaning that subsequent installations can be halted and inspected by a user if the attesting identity changes (or the package becomes unattested between versions).

Agree: signing is only as good as verification. However, trust-on-first-use (TOFU) is not the most secure way to map packages to attestations because nothing stops attackers who have taken over PyPI from tampering with the _unsigned_ mapping of identities to attestations in package lockfiles for new clients (certainly in containerized environments where everything could look new), and even just new versions of packages.

Although [PEP 458](https://peps.python.org/pep-0458/) is about signing the Python package index, it sets the foundation for being able to securely map packages to signed in-toto _policies_, which would in turn securely map identities to attestations. I think it is worth noting how these different PEPs can work together :)

amelius 2 hours ago
I'm curious what would happen if a maintainer's PC is compromised. Is there any line of defense left at that point?
Comma2976 6 hours ago
Great, now all that is missing is a decent packaging system for Python.