requirements.txt vulnerability scanner
Check a Python requirements.txt for known vulnerabilities. Every pinned package is looked up in OSV; lines without an exact version are listed, not hidden.
The file is read in your browser. Only package names and versions are sent to OSV when you scan.
This tool asks the OSV.dev vulnerability database directly from your browser. It sends the name, version and ecosystem of each package in the file, and then the IDs of the advisories that matched. The file itself, its paths, URLs and hashes stay in your browser, and nothing is sent to HardenKit.
How to use the requirements.txt vulnerability scanner
- Paste your requirements.txt, or drop the file on the page.
- Check how many pinned packages were found, then press the scan button.
- Read the vulnerabilities, worst first, with the fixed version of each.
- Look at the “Not checked” table and pin those lines, or scan a pip freeze of the environment instead.
About this tool
A requirements.txt tells pip what to install. Whether it can be checked for vulnerabilities depends on how it is written. A line such as django==4.2.7 names one exact version, and that version either has published advisories or it does not. A line such as django>=4.2 or just django names whatever is newest on the day of the install, so there is no single version to look up.
This scanner looks up every line pinned with == in OSV.dev, which holds the PyPA advisory database and the GitHub advisories for PyPI. Extras, environment markers and --hash options on a line are understood. Every other requirement is shown in a second table with its line number and the reason it was not checked: not pinned, a URL or path, an editable install, or a reference to another file.
The common mistake is to scan a hand-written requirements.txt that lists only direct dependencies. The packages those pull in are installed too and are not in the file. For a complete picture, scan the output of pip freeze from the real environment, or a file compiled with pip-compile, where every package is pinned.
Sources
Questions
Only a requirement with one exact version can be matched against advisories. Ranges such as >=, ~= and ==1.* are resolved by pip at install time, so the version depends on the day. The scanner lists each of those lines so you know what the result does not cover.
Run pip freeze > requirements.txt inside the virtual environment the application uses, or keep your direct dependencies in requirements.in and generate the pinned file with pip-compile from pip-tools. Both write every installed package with ==.
pip-audit is a command-line tool from the Python Packaging Authority that checks an environment or a requirements file, by default against PyPI’s advisory data. This page asks OSV.dev, which carries the same PyPA database, and runs without Python installed.
No. PyPI treats upper and lower case, dashes, underscores and dots in names as the same, so Flask_Cors and flask-cors are one project. The scanner normalizes names the way PyPI does before it asks OSV.dev.