-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Description
It seems that trivy supports poetry.lock and Pipfile.lock for Python, but not requirements.txt.
requirements.txt has dual usage:
- For some people, it's just high-level dependencies, unpinned to any particular versions.
- For other, it's equivalent to a lock file, transitively pinned dependencies often with hashes. For example, the
pip-toolspackage takes an unpinnedrequirements.inand generates a pinnedrequirements.txt.
More broadly, there's the issue of people who install packages using unpinned mechanisms, e.g. RUN pip install flask in their Dockerfile.
I can imagine a number of approaches:
- Add a parser for
requirements.txt, and just give up if it's unpinned. This will miss some vulnerabilities. - Run
pip listinside the container to get actually installed packages, and then you don't care how they were installed. The downside is that this is a big difference from your current mode of operation. - Do the equivalent of
pip listjust by inspecting the contents of anysite-packagesdirectories you find in the image. I went and asked apipdeveloper, and turns out allpip listdoes is look for<package name>-<version>.dist-infodirectories and uses that to get package name version. E.g. they look likeparamiko-2.7.1.dist-infofor packageparamikowith version 2.7.1
The third option seems like the easiest and most useful: it works for any Python environment and installation mechanism (it ought to work for Conda too, which is yet another packaging tool), and it's quite simple, just listing directories and parsing their names.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.Important over the long term, but may not be staffed and/or may need multiple releases to complete.