r/Python • • May 07 '26

Discussion Do we really check library security?

PyPi's filtering isn't cutting it. We all know it. I know the people about to say to just use the popular libraries that have community moderation.

The recent claude code injection hack in Torch has proved that isn't a solution.

https://www.reddit.com/r/Python/s/2lwDYSv0eT

And scanning packages are either unmaintained or maintained by one dev in the middle of nowhere.

https://pypi.org/project/safety/

So, I honestly ask you, short of reading each libraries code by hand or avoiding them entirely how do you stay safe?

Sandbox enviroments? Winging it? Hope?

25 Upvotes

51 comments sorted by

View all comments

Show parent comment

0

u/No-Article-Particle May 07 '26

No, this is corporate reality. In critical software, yes, there are security teams going through every library you use. They might not read every line, but they absolutely study every dependency and every time you want to upgrade it.

Of course you took it ad absurdum and they just study the Python code or the C code that it binds, but that's not uncommon for corporate SW.

1

u/me_myself_ai May 08 '26

Oh sure in some environments it’s someone’s job to look through that kind of stuff full time. But that’s not a dev, and also a tiny tiny percentage of all the professional python in the world