-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot handle ">=" in requirements.txt #421
Comments
Thanks for the report! Could you clarify what your expected behavior is here? This is very similar to what $ python -m pip install 'lxml>=4.5.1'
Collecting lxml>=4.5.1
Downloading lxml-4.9.1.tar.gz (3.4 MB)
|████████████████████████████████| 3.4 MB 2.5 MB/s
Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.
Installing collected packages: lxml
Running setup.py install for lxml ... done
Successfully installed lxml-4.9.1 As such, |
Expected behaviour List the versions in that range that contain a known vuln, or print the most recent insecure/secure version. So that I, as a package maintainer, can easily specify minimum secure versions not just minimum functional versions. I appreciate that Implementation It appears simple to retrieve versions via PYPI API, then just loop over them. |
@di pointed out an important qualification to me: if $ pip-audit -r <(echo 'lxml>=4.5.1,<4.5.2')
WARNING:cachecontrol.controller:Cache entry deserialization failed, entry ignored
Found 4 known vulnerabilities in 1 package
Name Version ID Fix Versions
---- ------- -------------- ------------
lxml 4.5.1 PYSEC-2021-19 4.6.3
lxml 4.5.1 PYSEC-2020-62 4.6.2
lxml 4.5.1 PYSEC-2021-852 4.6.5
lxml 4.5.1 PYSEC-2022-230 4.9.1 ...but I can see a case where So this is definitely a source of user confusion that we should improve. Some options:
cc @di for thoughts as well 🙂 |
@ValueRaider, what would you expect to happen with transitive dependencies? For example, if |
I suspect we are discussing 2 slightly different use cases here, which would expect slightly different behaviour:
I think use case 2 is important because I suspect most Python end-users don't check for module vulnerabilities. Transitive dependenciesI think scanning sub-dependencies is useful, but I appreciate the additional complexity of implementation and presentation. "Perfection is the enemy of progress" comes to mind - simply just scanning the top-level is a great improvement over current behaviour, and if most maintainers adopted this then wouldn't need to scan entire tree. |
Yeah, we sort of conflate these use cases: we expect users to understand that Maybe another option here is to add an optional flag, something like |
Some extra flag makes sense. |
The vast vast majority of Python packages use
>=
in their requirements.txt not==
. Butpip-audit
is not flagging vulnerabilities when>=
used.E.g., take this example requirements.txt:
lxml 4.5.1 contains a vulnerability but is not flagged by
pip-audit
. Only flagged if>=
replaced with==
The text was updated successfully, but these errors were encountered: