pip-audit
$ pip-audit Foundation Low Riskpip-audit is the Python Packaging Authority (PyPA) tool for auditing Python environments, requirements.txt, and pyproject.toml files against the PyPI and OSV vulnerability databases. It supports -f json and -f sarif outputs, --fix --dry-run upgrade previews, and offline vulnerability-service caching.
brew install pip-audit pip-audit -f json inspects the active virtualenv or requirements lockfile locally in one command without needing an MCP server.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
First-class -f json|sarif, --fix --dry-run, -r file targeting, and zero interactive prompts.
- Supports
-f json,-f sarif,--fix --dry-run, and-r
Read-only vulnerability lookup by default; --fix explicitly supports --dry-run before mutating environments.
- Read-only default plus
--dry-runon upgrades
Trivial installation via brew install pip-audit, pip install pip-audit, or uvx pip-audit across macOS, Linux, and Windows.
- Available on Homebrew, PyPI, and uvx
Authoritative PyPA vulnerability scanner backed by both PyPI and OSV advisory feeds.
- Supports
--vulnerability-service pypi|osv
Official PyPA project originally developed by Trail of Bits with Google support.
- Maintained under github.com/pypa/pip-audit
Clear README and CLI --help covering formats, hashes, and local cache behavior.
- Official PyPA docs and PyPI page
Security, Auth & Guardrails
None required; queries public PyPI/OSV advisories and caches data locally.
100% free and open-source (Apache-2.0).
# pip-audit Agent Rules - Always run read-only (`-f json`) or `--fix --dry-run` before applying `--fix`. - Pass `-r <requirements.txt>` explicitly when auditing a project rather than unintentionally auditing the global Python environment.
Agent-Ready Command Recipes
Safe Read-Only Queries
pip-audit -r requirements.txt -f json
Resolves dependencies in requirements.txt and outputs known CVEs and fix versions in structured JSON.
pip-audit --fix --dry-run -f json
Computes which vulnerable packages --fix would upgrade in the active environment without modifying any installed packages.
Controlled Writes & Previews
pip-audit --fix -r requirements.txt
Upgrades vulnerable dependencies to patched versions after previewing changes with --dry-run.
Strengths for Agents
- + Native
-f json,-f sarif, and--fix --dry-runprovide ideal agent safety and parsing. - + Official PyPA lineage with both PyPI and OSV advisory databases.
Caveats & Pitfalls
- ! Auditing unpinned
requirements.txtinvokes dependency resolution which requires network access unless--no-depsor pre-resolved files are used. - ! Exits non-zero when vulnerabilities are found, which scripts should treat as an expected signal.