mrkeyoor.com_
Tue 22 Sept 22:36 UTC
PyPIUtilsupdated 22 Sept 2026

pip-audit review

pip-audit 2.10.1 collects Python package names and versions from an environment, requirements files, a local project, or PEP 751 locks, then matches them against vulnerability records. PyPI is the default feed; OSV, a custom OSV endpoint, and Ecosyste.ms are options. It can print tables, Markdown, JSON, or CycloneDX and can preview or apply package upgrades. Version 2.10.1 stops a KeyError when an OSV affected entry omits the optional ranges field. A zero result means the selected feed had no matching record, not that application code is safe.

Verdict

Our pip-audit 2.10.1 install took 0.5 seconds, used 27 MB across 29 packages, imported in 0.01 seconds, and found no known vulnerabilities in its fresh environment. Use it as a Python dependency-advisory gate, with separate source scanning and trusted, pinned inputs.

We installed it

Lab card: what happened when we installed pip-auditScreenshot of pip-audit documentation
Install✓ · 0.5s29 packages on disk · 27 MB
Importimport pip_audit in 0.01s · pure Python · requires Python >=3.10
Known vulns0(pip-audit)

Answers from our run

Does pip-audit install cleanly?

Yes. In a fresh container with an empty cache, pip install pip-audit finished in 0.5s, leaving 29 packages and 27 MB on disk. pip-audit reported no known vulnerabilities.

What does pip-audit need to run?

Python >=3.10, and nothing compiled: it is pure Python. In our run import pip_audit succeeded in 0.01s.

pip-audit or safety: which should you use?

safety: Use it when hosted policy controls and managed exception workflows justify a commercial product. Our pip-audit 2.10.1 install took 0.5 seconds, used 27 MB across 29 packages, imported in 0.01 seconds, and found no known vulnerabilities in its fresh environment.

When should you not use pip-audit?

You need source-code security analysis; pip-audit matches distribution versions and does not inspect your Python functions

API stability4/5The 2.x CLI retains environment, requirements, project, lock, service, output, ignore, dry-run, and fix paths while adding services and PEP 751 support around them. Version 2.10.1 changes malformed OSV-record handling rather than command syntax. The maintained contract is the executable and its output formats, not imported Python internals. Our package check also found no py.typed marker, which makes internal-module consumers a poor bet.
Docs5/5The GitHub README returns HTTP 200 and includes the generated option reference, input modes, environment variables, exit codes, dry-run semantics, private-index notes, resolver performance advice, and an unusually candid security model. It says dependency scanning is not source analysis and warns that requirements processing can execute build code. Missing pieces are a versioned JSON schema and a first-class policy file for expiring accepted findings.
Maintenance4/5Release 2.10.1 arrived on June 10, 2026 with a narrow fix for OSV entries that omit ranges. GitHub shows an unarchived PyPA repository pushed on August 20, 2026, with 1,353 stars and 69 open issues and pull requests combined. Recent work and PyPA stewardship are sound maintenance signals. The release cadence looks deliberate, which suits a packaging security command whose behavior depends on external advisory services.
Ecosystem4/5The supplied weekly figure is 7,352,845 PyPI downloads, and the project has an official GitHub Action plus pre-commit, conda-forge, PyPI advisory, OSV, Ecosyste.ms, JSON, Markdown, and CycloneDX paths. That integration is strong inside Python packaging. It does not replace a container scanner, operating-system package scanner, secret scanner, or source analyzer, so mixed-language teams still need a broader security toolchain.

Use it if

  • CI needs a noninteractive failure when an exactly pinned Python dependency matches a published advisory
  • The same dependency collection should emit CycloneDX JSON or XML for another security system
  • Requirements or PEP 751 inputs are trusted, pinned, and preferably hashed before the audit starts
  • PyPI or OSV advisory coverage is acceptable without a commercial account or hosted policy console
Skip it if

Setup reality

We installed pip-audit 2.10.1 in a clean Python 3.12 Bookworm sandbox in 0.5 seconds. The tool left 29 packages and 27 MB on disk. It declares 23 direct dependencies, requires Python 3.10 or newer, and is pure Python. The distribution uses the Apache Software License and does not ship py.typed. import pip_audit worked in 0.01 seconds. Running pip-audit against that fresh environment returned zero known vulnerabilities.

Keep this 29-package tool tree in a dedicated CI or tooling environment instead of the application under inspection. With no input arguments it checks the active interpreter environment. -r reads requirements, a path reads supported project metadata, and --locked targets PEP 751 lockfiles. If the input is not fully resolved, pip-audit creates a temporary environment and invokes packaging machinery. That can take about as long as installation and may execute build hooks, so only audit trusted dependency files.

Exact pins with --no-deps avoid another resolver pass. --require-hashes is a firmer CI boundary because it also requires hashes for every requirement. Private repositories use pip-style index options, but the documented authentication path is noninteractive; supply approved credentials through the runner rather than expecting a prompt. Advisory queries still require network access unless the organization provides a compatible reachable endpoint, and service outages should be distinguished from a clean scan.

Exit code 0 means no matched findings and exit code 1 means one or more findings; the CLI does not suppress that status. --fix --dry-run reports proposed version changes before touching the environment. Each accepted result needs an --ignore-vuln flag, with owner, reason, and review date stored beside the CI command because the flag has no expiry field. Teams that fail only on fixable records need to parse JSON and apply that policy themselves.

Patterns

Audit the active interpreter environment audit-environment

pip-audit

# exclude packages outside the local environment
pip-audit --local

--local excludes packages outside the local environment, but PATH still decides which Python installation is examined.

Scan trusted requirement files audit-requirements

pip-audit -r requirements.txt
pip-audit -r requirements.txt -r requirements-dev.txt

Resolving requirements can run package build hooks; do not point this command at dependency text from an untrusted source.

Avoid a second dependency resolution avoid-resolution

pip-audit --no-deps -r requirements.txt
pip-audit --require-hashes -r requirements.txt

--no-deps needs exact pins, while --require-hashes also checks that every requirement carries an integrity hash.

Fail CI on a matched advisory gate-ci

- name: Audit Python dependencies
  run: pip-audit -r requirements.txt --require-hashes

pip-audit exits with status 1 when it reports one or more findings, so the shell step blocks by default.

Ignore one reviewed advisory ignore-advisory

pip-audit -r requirements.txt \
  --ignore-vuln GHSA-w596-4wvx-j9j6

--ignore-vuln records no owner, reason, or expiry; place those details beside the CI command.

Write machine-readable findings write-json-report

pip-audit -r requirements.txt -f json -o audit.json

JSON includes advisory aliases and fix versions that a policy step can inspect without scraping the table output.

Emit CycloneDX JSON produce-cyclonedx

pip-audit -r requirements.txt -f cyclonedx-json -o sbom.json

A completed SBOM file does not force exit status 0; vulnerability findings still determine the process result.

Point OSV queries at a mirror use-osv-mirror

pip-audit -s osv --osv-url https://osv.internal.example/v1/query -r requirements.txt

The supplied URL must implement the OSV query shape expected by pip-audit 2.10.1.

Audit PEP 751 lockfiles audit-pep751-lock

pip-audit --locked .

--locked searches for pylock.*.toml; tool-specific lock formats need conversion before this command.

Preview dependency upgrades preview-fixes

pip-audit --fix --dry-run
# after review
pip-audit --fix

--fix --dry-run leaves packages unchanged, and applied upgrades still need the application test suite.

Alternatives

PackageRegistryPick it when
safetyPyPIUse it when hosted policy controls and managed exception workflows justify a commercial product
banditPyPIUse it to find insecure patterns in Python source instead of dependency advisories
cyclonedx-bomPyPIUse it when producing a Python SBOM is the goal and another system handles vulnerabilities
osv-scannerPyPIUse it for a multi-ecosystem OSV scan rather than a Python packaging-focused command

More utils guides

lru-cache · ajv · type-fest · p-limit · find-up · js-yaml · the whole shelf →

How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.