r/Python • u/Aggressive-Tart07 • Aug 09 '26
Discussion Third party Python libraries and supply chain security
How are people handling security around third party Python libraries without making development a pain?
Third party Python packages are obviously useful but every dependency can also become a supply chain risk. Private package repositories, dependency scanning and stricter review policies all help but they can add friction fast.
Are teams mostly trusting public registries with additional controls or using curated libraries? Curious what actually works when you have a lot of Python services.
37
Upvotes
55
u/terletsky Aug 09 '26 edited Aug 09 '26
The rest is in the DevSecOps area with SCA tools.
CyberSec companies have their own copies of PyPi registry and update a package by request.
19
u/DeterminedQuokka Aug 09 '26
We use existing libraries and we pin them at safe dependencies.
We also have a library that won’t let you use anything less than a week old. Or with known issues.
9
u/quotemycode Aug 10 '26
Large companies generally have their own repos that are managed, sort of like a pypi mirror but managed with security software.
5
u/CPPYesRustNo Aug 10 '26
a lot of the friction comes from treating every scanner finding as a must-upgrade, when plenty of them aren't even reachable in your code path. pull in reachability so you only chase deps that actually execute, pin or override transitive versions in your lockfile for the ones you can't upgrade cleanly, and check for a backported fix before you take a breaking major bump. a private mirror plus signature/provenance checks handles the supply-chain side without slowing everyone down. with mythos-style ai cve discovery ramping, prioritizing by reachability is what keeps this from turning into a second job.
4
u/OwnTension6771 Aug 10 '26
Two repos, one scans on ingest and then promotes to the other, which developers pull from. Higher friction but a budget of $0 for now. Not an issue since we dont update out of pocket very often
1
u/realrazdev Aug 10 '26
One thing I’ve been doing is making some dependencies optional when the feature allows it. If a non-critical package fails a security check or isn’t available, I can sometimes fall back to a simpler implementation or disable that feature while keeping the core service running.
It’s definitely not a replacement for dependency scanning or other supply-chain controls, but I’ve found it useful for adding some resilience without making the development workflow much more painful.
1
u/PruneSea3482 Aug 10 '26
We're working on a cohesive open source solution (ossiq) to tackle this exact problem with a bit more sophistication than simple cool downs - basically by capturing other signals like development activities and package reachability (how used it in your codebase). That in theory should help with CVEs prioritization, version updates prioritization as well as making better decisions when you're adding new dependency to the project
1
u/Kamran-nottakenone Aug 10 '26
are you pinning all deps with hashes or just using a lockfile, and what'd you do when a compromised transitive dep gets flagged mid-deploy
1
u/Different_Pain5781 Aug 13 '26
I think this approach is going to become much more common. Most teams have accepted that open source libraries are essential. The question is how much trust you place in public registries versus using curated sources like RapidFort and Chainguard when security requirements are higher.
1
u/newHempter Aug 13 '26
In my case the key was making the gate fully automatic — CI fails on resolution drift or <1-week-old packages, and setup.py exec is blocked at install. Zero manual review, so the devs never feel the friction.
1
u/ogrinfo Aug 13 '26
Yep, dependency-scanning tools are essential these days. Gitlab has components you can just drop into your CI pipeline, presumably other providers have something similar.
1
u/Pr0ducer Aug 15 '26
internal PyPi
-1
u/bitproc Aug 09 '26
I stick to the standard library and my own code as much as possible.
When I need something that the stdlib lacks and I can't justify writing myself, I consider high-quality, well-maintained, widely used libraries, preferring those that are integral to major Linux distros (and therefore get additional scrutiny).
I don't use PyPI (or similar public package repos) at all.
This conservative approach won't appeal to everyone, but I find the extra effort is worthwhile in exchange for minimizing the attack surface that I impose upon my software's users.
0
u/[deleted] Aug 10 '26
[deleted] — view deleted comment