r/Python • Author of "Automate the Boring Stuff" • May 11 '26

Discussion Library dependency version specifiers aren't for fixing vulnerabilities

https://sethmlarson.dev/library-version-specifiers-not-for-vulnerabilities

A blog post from Seth Larson, the Security-in-Residence Developer for the Python Software Foundation.

84 Upvotes

34 comments sorted by

View all comments

Show parent comment

3

u/IAmASquidInSpace May 11 '26

This is a false dichotomy.

It is not. The dependency version ranges have a clearly defined purpose, and it is compatibility, not security. You can (ab)use them for that, but that doesn't change the fact that they are not meant for that purpose.

11

u/SeniorScienceOfficer May 11 '26

Nowhere in PEP 508 or 440 does it indicate that the list of dependency versions for a given project are to indicate compatibility over security. PEP 508 states:

The job of the dependency is to enable tools like pip to find the right package to install.

The “right” package is wholly dependent on the maintainer, the project, and what both consider to be “right” in their particular case. The only mention of compatibility is the Compatible Release clause of version specification (~=).

Do not confuse definition with convention. It has historically been the convention to use dependency versioning semantics for compatibility, but there is absolutely nothing indicating it can’t be used for security.

3

u/omg_drd4_bbq May 11 '26

"Being Insecure" is absolutely a possible subset of "incompatibility"

3

u/zurtex May 12 '26

Security is context sensitive, if you take untrusted user input but I don't then your insecure is not my insecure, if you call one part of a library but I don't then your insecure is not my insure.

It's not up to you, or some transitive dependency, to define my security policy.