← pip-audit Triage

How to triage pip-audit findings without ignoring real risk

pip-audit checks every package in an environment or requirements file against a vulnerability database and prints them in the order it found them, with no severity. On a service with a few hundred transitive dependencies that is a list nobody can act on in one sitting. Sorting it by whether your code imports the package turns it into a short first pass.

The three buckets this tool uses

A sensible order

  1. Run pip-audit -f json against the environment you deploy, then feed it and your source to the triage.
  2. Upgrade the imported packages first, using the fix versions pip-audit lists. When a package has several advisories, pick a version that clears all of them.
  3. Use --fail-on-imported in CI so a newly vulnerable package your code imports blocks the merge while unreferenced noise does not.
  4. For not-referenced packages, find the parent with pipdeptree -r -p <package>. If the parent is something you import, treat the finding as reachable.
  5. Batch the test-only upgrades into your normal dependency-update cadence. Do not defer one that runs in CI with deploy secrets.

What this ranking cannot tell you

It reads import statements as text. It cannot see an import built from a variable, a plugin loaded through an entry point, or whether the vulnerable function is ever called. It also cannot see the dependency graph, so a package your code reaches only through another package is labelled not-referenced. Not imported lowers the urgency; it is not a certificate of safety, and this is not a security audit.