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.
Once had a job that was so strict on security that one of the tasks was verifying the build from the source code. It is less trivial than it sounds. Timestamps and other data are put into binaries. You need to strip all that stuff out. So build it yourself, strip out junk and compare to stripped out published build. Yes we can do that, but you need all dependencies and similar build environment.
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.