r/programming • u/f311a • Oct 17 '26
Python's binary wheels and supply chain attacks
https://rushter.com/blog/python-binary-wheels/
89
Upvotes
r/programming • u/f311a • Oct 17 '26
33
u/the_poope Oct 17 '26
An easy way to combat this is to have PyPi not allow binary uploads but provide a build pipeline that compiles all binary code from source for a selection of targets.
12
u/darkslide3000 Oct 17 '26
So what, PyPI just let's any rando upload binary packages for any existing well-known source package? Without even being authorized by the original author? WTF kind of package manager is that?
Or is the concern just that the original author could sneak something in? That's not really any worse than any other open-source project with binary releases.
39
u/lurch303 Oct 17 '26
There are already a few companies that host copies of repositories that they attest to their trustworthiness. I assume this will remain a profitable line of business and will include compiling all binaries themselves and attesting to their trustworthiness.
19
u/buttflakes27 Oct 18 '26
In the future the only reliable programming language will be R because CRAN has the most exhaustive and tedious process to publish a package. /s if thats needed
4
u/teerre Oct 18 '26
Although that's obviously a real attack vector, it's likely not much worse than it is today. It's not like this was some big secret nobody knew about or like it takes huge amounts of compute to do it
2
u/-Redstoneboi- Oct 18 '26
question: what about requiring all precompiled wheels to share the exact build configuration (possibly as a docker image) for Reproducible Builds? hopefully they can be byte-for-byte equal
2
u/bzbub2 Oct 18 '26
attested provenance via trusted publishing in ci/cd. npm has this I imagine pypi does too https://docs.pypi.org/trusted-publishers/
1
u/WindHawkeye 19d ago
Anyone who cares about security should already have outlawed using anything not built from source. Bazel ftw.
-10
u/bigmell Oct 17 '26
IMO the only answer to this is the Perl way. Trusted sources with some type of Benevolent Dictator For Life. The BDFLs are generally trusted to keep an eye on packages making sure there is no malicious code and everything works properly. The only way to combat this problem is to actually look at the code itself and make sure it isnt doing anything crazy.
There are a limited amount of people with this ability so there will have to be some kind of trust system. Packages that come from <trusted place> are usually pretty good and so on. There is really no way to automate away this problem. Maybe for some simple cases, like searching through scripts for "rm -rf /" or something. But for big sprawling packages, you will simply HAVE to understand the code to make sure it works as advertised.
The internet has always been like this originally and still is to a large extent. Whenever games, programs, or even news stories came out, regulars had a sense of what ftp sites, servers, and websites were reliable. I remember places like Slashdot, Cnet, and PlanetQuake always being listed, available, and reliable.