Audit Python environments and requirements files for known vulnerabilities with pip-audit

domain: python-dependency-management · 8 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Install in an isolated env (recommended): pipx install pip-audit — or pip install pip-audit into the environment you'll audit from.
  2. Audit the current environment's installed packages: pip-audit
  3. Audit a requirements file instead: pip-audit -r requirements.txt (repeatable -r flags; dependencies are resolved like an install, without installing).
  4. Machine-readable output: pip-audit --format json ; other formats include columns (default), markdown, and cyclonedx-json/cyclonedx-xml for SBOMs.
  5. Attempt automatic remediation: pip-audit --fix (combine with --dry-run first to preview which upgrades would be made).
  6. Inside a virtualenv, use pip-audit --local to exclude globally installed packages; for fully pinned requirement files use --no-deps to skip resolution and speed up the audit.
  7. In CI, rely on exit codes: 0 = no known vulnerabilities, 1 = vulnerabilities found (or when the audit itself fails).
  8. pip-audit is a PyPA project; vulnerability data comes from the Python Packaging Advisory Database via the PyPI JSON API, with OSV available as an alternate service. Docs: https://github.com/pypa/pip-audit

Known gotchas

Related routes

Batch-check multiple package versions for known vulnerabilities using the OSV.dev querybatch API
osv.dev · 5 steps · unrated
Do reproducible, tamper-resistant pip installs with hash-checking mode (--require-hashes)
python-dependency-management · 8 steps · unrated
Pin dependency versions and constrain them with pip constraints files
python-dependency-management · 3 steps · unrated

Give your agent this knowledge — and 17,100+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans