> Trusted Publishing<p>Why do people come up with such unbelievably complex solutions that don’t actually achieve what a simple solution could do?<p>Trusted Publishing approximately involves a service like GitHub proving to somebody that some release artifact came from a GitHub Actions workflow file with a particular name, possibly in a particular commit. Never mind that GitHub Actions is an unbelievable security nightmare and that it’s probably not particularly hard for a malicious holder of GitHub credentials to stealthily or even completely silently compromise their own Actions workflow to produce malicious output.<p>But even ignoring that, it’s wildly unclear what is “trusted”. PyPI encourages developers to also use “attestations”. Read this and try to tell me <i>what</i> is being attested to:<p><a href="https://docs.pypi.org/attestations/producing-attestations/" rel="nofollow">https://docs.pypi.org/attestations/producing-attestations/</a><p>But I did learn that this is based on Sigstore. Sigstore is very impressive: it’s a system by which GitHub can attest via OIDC to various state, and a service called Fulcio (which we’re supposed to trust) uses its secret key to sign a message stating that GitHub did so at a certain time. (The OIDC transcript itself is not a durable attestation.) There’s even a transparency log (which is a separate system called Rekor maintained by the same organization). Except that, for some reason, Fulcio doesn’t do that at all. Instead it issues an X.509 certificate with an expiration in the near future where the certificate fields encode whatever GitHub attested to in its OIDC exchange, and the Sigstore client (which is hopefully a bit trustworthy) is supposed to use the private key (which it knows, in the clear, but is supposed to immediate forget) to sign a message that is associated with the release artifact or whatever else is being attested to. And then a separate transparency log records the signature and supposedly timestamps it so everyone one can verify the attestation later even though the certificate is expired! Why not just sign the message on the Fulcio server (which has an HSM, hopefully) directly?<p>All of this is trying to cryptographically tie a package on PyPI.org to a git tag. But: why not just do it directly? For most pure Python packages, which is a whole lot of packages, the distribution artifact is literally a zip file containing files from git, verbatim, plus some metadata. PyPI could check the GitHub immutable tag, read the commit hash, and verify the whole chain of hashes from the files to the tree to the commit. Or PyPI could even run the build process itself in a sandbox. (If people care about .pyc files, PyPI could regenerate them (again, in a sandbox), but omitting them might make sense too — after all, uv doesn’t even build them by default.) This would give <i>much</i> stronger security properties with a much more comprehensible system and no dependence on the rather awful security properties of GitHub Actions.
You linked to a page that has the "how" of attestations, not the "what," so it's not super surprising that you don't see an answer there. This page details the "what"[1].<p>> PyPI could check the GitHub immutable tag, read the commit hash, and verify the whole chain of hashes from the files to the tree to the commit.<p>Tags are neither immutable nor durable on GitHub. This also breaks in the presence of any non-trivial build backend, including anything that produces a non-pure-Python wheel. Complexity is often bad, but just about every complex aspect of PyPI's attestation scheme has a reason behind it.<p>[1]: <a href="https://docs.pypi.org/attestations/publish/v1/" rel="nofollow">https://docs.pypi.org/attestations/publish/v1/</a>
This does seem wildly overcomplicated. Here is the attestation system they use: <a href="https://github.com/in-toto/attestation/blob/main/spec/README.md" rel="nofollow">https://github.com/in-toto/attestation/blob/main/spec/README...</a><p>Why not Just(TM) enforce a reproducible build process? That brings some of its own challenges, but would represent a real upgrade over building out some Swiss cheese like this.
Golang did the right thing by just wrapping git clone.
One of the big companies making billions on Python software should step up and fund the infrastructure needed to enable PyPI package search via the CLI, like you could with `pip search` in the past.
Serious question: how important is `pip search` to your workflows? I don’t think I ever used it, back when PyPI still had an XMLRPC search endpoint.<p>(I think the biggest blocker on CLI search isn’t infrastructure, but that there’s no clear agreement on the value of CLI search without a clear scope of what that search would do. Just listing matches over the package names would be less useful than structured metadata search for example, but the latter makes a lot of assumptions about the availability of structured metadata!)
Not important at all now, given that it hasn't worked in a decade and I've filed it away as pointless to even consider for a workflow.<p>However, I get a lot of mileage out of package repository search with package managers like pacman, apt, brew, winget, chocolatey and npm.<p>> <i>I think the biggest blocker on CLI search isn’t infrastructure</i><p>It's why it was shut down, the API was getting hammered and it cost too much to run at a reasonable speed and implement rate limiting or whatever.
> It's why it was shut down, the API was getting hammered and it cost too much to run at a reasonable speed and implement rate limiting or whatever.<p>Sort of: the original search API used a POST and was structured with XML-RPC. PyPI’s operators went to great efforts to scale it, but that wasn’t a great starting point. A search API designed around caching (like the one used on PyPI’s web UI) wouldn’t have those problems.
I upvoted you because I broadly agree with you, but search is never coming back in the API. They previously outlined the cost involved and there's no way, given how minimal the value it gives more broadly, it's coming back ant time soon. It's basically an abusive vector because of the compute cost.
Funding could help, but it still requires PyPI/Warehouse to ship and operate a new public search interface that is safe at internet scale.
They operate a public package hosting interface, how is a search one any harder?
Pypi has a search interface on their public website, though?
If you really need it, they publish a dump regularly and you can query that.<p>For simple use cases, you have the web search, and you can curl it.
They probably don't need it. You can start a crowdfunding campaign if you do.
> More than 3.9 million new files published<p>> More than 130,000 new projects created<p>Is there any way to prevent PyPI from becoming a morass of supply chain attacks like NPM etc.? The cited security measures (though some of them like domain resurrection protection are probably very good ideas) seem like they won't, but it also seems like a very hard problem to solve, given the vast scale as well as core issues like malicious (but seemingly innocuous) upstream commits.
Great work Dustin and team!
Great work!<p>Side issue: anyone else seeing that none of the links in the article work? They're all 404s.
Is the compute and network required to service pypi all from donations or do they have any business arm that generates income?
> 1.92 exabytes of total data transferred<p>That's something like triple the amount from 2023, yes?
This seems to suggest once the bubble pops, it will take Python down with it. The next AI winter will definitely replace Lisp with Python.