pip-audit for a self-hosted AI server: 63 advisories in a 10-package stack

pythonself-hostingsecuritymaintenancepip

TL;DR: pip-audit (2.10.1, Apache-2.0, on PyPI since June 10, 2026) checks the Python packages in an environment against PyPI’s advisory database and tells you the exact version that fixes each one. On a deliberately stale 10-package environment it reported 63 advisory entries across 7 packages (33 unique IDs), and the exit code was 1. On a current 39-package stack it printed “No known vulnerabilities found” and exited 0. It needs no GPU, no paid service, and about a second of CPU — the expensive part is not the scan, it is the upgrades.

Everything below was run on November 22, 2026 with pip-audit 2.10.1 and Python 3.13. The tables and outputs are copied from that run.

What does pip-audit actually check?

pip-audit compares the versions of the Python packages you have installed against the advisories published in PyPI’s advisory database (the PYSEC-2026-… identifiers). For every match it prints the package, the version you have, the advisory ID, and the versions that fix it.

What it does not check: your own code, your Linux packages, your CUDA driver, your container image, or whether anything is actually reachable from the internet. It is a version-matching tool for one ecosystem.

That distinction matters for self-hosters. A self-hosted AI server usually has three dependency surfaces — the Python environment, the OS image, and the model files — and pip-audit only covers the first one. It is still the cheapest one to cover, because it is the one where “fix it” means pip install -U instead of rebuilding an image.

How do I audit a running self-hosted environment?

Install it into its own environment so the auditor itself does not pollute the stack you are auditing:

$ python3 -m venv /tmp/paudit-venv
$ /tmp/paudit-venv/bin/pip install pip-audit
$ /tmp/paudit-venv/bin/pip-audit --version
pip-audit 2.10.1

Then point it at the site-packages directory of the environment you want to check:

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/stack-venv/lib/python3.13/site-packages
No known vulnerabilities found

That was a current 39-package stack (FastAPI 0.165.0, uvicorn 0.54.0, pydantic 2.14.4, huggingface_hub 2.4.0, safetensors 0.8.0, requests 2.34.2, redis 8.1.0, SQLAlchemy 2.1.9, pip 26.3), installed the same afternoon. Nothing to fix.

The same command against a stale environment is where it gets interesting. I built one out of old pins — requests==2.25.1, jinja2==3.0.3, urllib3==1.26.5, setuptools==65.5.0, pip==24.0, pyyaml==5.3.1 — and ran the identical command:

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/vuln-venv/lib/python3.13/site-packages
Found 63 known vulnerabilities in 7 packages
Name       Version ID                  Fix Versions
---------- ------- ------------------- -------------
idna       2.10    PYSEC-2024-60       3.7
idna       2.10    PYSEC-2026-215      3.15
jinja2     3.0.3   PYSEC-2026-1473     3.1.3
jinja2     3.0.3   PYSEC-2026-1474     3.1.4
jinja2     3.0.3   PYSEC-2026-1475     3.1.5
jinja2     3.0.3   PYSEC-2026-1472     3.1.5
jinja2     3.0.3   PYSEC-2026-1471     3.1.6
pip        24.0    PYSEC-2026-1795     25.3
pip        24.0    PYSEC-2026-1796     26.0
pip        24.0    PYSEC-2026-2875     26.1
pip        24.0    PYSEC-2026-2876     26.1
pip        24.0    PYSEC-2026-196      26.1.2
pip        24.0    PYSEC-2026-3721     26.2
pyyaml     5.3.1   PYSEC-2021-142      5.4
requests   2.25.1  PYSEC-2023-74       2.31.0
requests   2.25.1  PYSEC-2026-1873     2.32.0
requests   2.25.1  PYSEC-2026-1872     2.32.4
requests   2.25.1  PYSEC-2026-2275     2.33.0
setuptools 65.5.0  PYSEC-2022-43012    65.5.1
setuptools 65.5.0  PYSEC-2025-49       78.1.1
urllib3    1.26.5  PYSEC-2026-1994     2.6.0
urllib3    1.26.5  PYSEC-2026-1995     1.26.19,2.2.2
urllib3    1.26.5  PYSEC-2026-4177     2.8.0

Two details worth reading twice. The pip row is the one people forget: the installer that put your stack on disk was itself carrying six advisories, and the fix is pip 26.2 or newer. The fix version is a floor, not a suggestion — requests needs 2.33.0, not “the latest”, because that is the first version with every one of its four open advisories closed.

Note also that the printed table repeats every row: 63 rows but 33 unique advisory IDs, because the packages are found in two installation paths. Count unique IDs, not rows, when you report a number.

How do I read the advisory text?

--desc adds the full advisory description, which is where the practical detail lives:

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/vuln-venv/lib/python3.13/site-packages --desc
requests   2.25.1  PYSEC-2026-1872     2.32.4
### Impact
Due to a URL parsing issue, Requests releases prior to 2.32.4 may leak .netrc
credentials to third parties for specific maliciously-crafted URLs.
### Workarounds
For older versions of Requests, use of the .netrc file can be disabled with
`trust_env=False` on your Requests Session.

That is the difference between “upgrade something” and “here is the one-line mitigation if you cannot upgrade today”. For a self-hosted server behind a reverse proxy, the trust_env=False workaround is often enough to buy a week.

How do I audit a requirements file instead of a live environment?

Export the pins and audit the file — this is the mode you want in CI, where there is no live environment:

$ /tmp/stack-venv/bin/pip list --format=freeze | grep -v "^pip==" > requirements.txt
$ wc -l < requirements.txt
39
$ /tmp/paudit-venv/bin/pip-audit -r requirements.txt
No known vulnerabilities found

In this mode pip-audit builds a throwaway virtual environment and resolves your requirements there, which means it needs network access to your index. Two failure modes I hit for real:

  • A pin that does not exist stops the whole run before any advisory is checked:

    ERROR: No matching distribution found for fastapi==0.121.4
    ERROR:pip_audit._virtual_env:internal pip failure: ...
  • --no-deps skips resolution and warns you about the trade-off:

    WARNING:pip_audit._cli:--no-deps is supported, but users are encouraged to fully hash their pinned dependencies
    WARNING:pip_audit._cli:Consider using a tool like `pip-compile`: https://pip-tools.readthedocs.io/en/latest/#using-hashes

    That warning is not pedantry — it points at the same problem our pip --require-hashes guide solves: without hashes you are auditing pins, not artifacts.

How do I make it fail a CI build?

pip-audit uses the exit code, which is the whole CI integration:

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/vuln-venv/lib/python3.13/site-packages; echo "exit=$?"
Found 63 known vulnerabilities in 7 packages
exit=1

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/stack-venv/lib/python3.13/site-packages; echo "exit=$?"
No known vulnerabilities found
exit=0

For a machine-readable report, --format json prints the dependency list and the advisories per package (the human-readable summary goes to stderr, so 2>/dev/null leaves you clean JSON):

$ /tmp/paudit-venv/bin/pip-audit --path /tmp/vuln-venv/lib/python3.13/site-packages --format json 2>/dev/null | python3 -c "..."
dependencies in json: 10
vulnerable deps: 7
total vuln entries: 63
example: idna 2.10 ['PYSEC-2024-60', 'PYSEC-2024-60', 'PYSEC-2026-215']

What does it cost, and what does it need?

ItemCost / requirement
Tool$0 — pip-audit 2.10.1 is on PyPI, Apache-2.0 licensed
Python≥ 3.10 (it runs on 3.13 here)
HardwareNo GPU, no model, no RAM requirement worth mentioning — it is a metadata lookup
NetworkIt queries PyPI’s advisory API; the response cache lives in ~/.cache/pip-audit (2.0 MB after the runs above)
TimeUnder a second for a 39-package environment, plus the temp-venv build in -r mode
Real costThe upgrades: a pip install -U pass plus a regression test of your own stack

That last row is the honest one. The scan is free; the fix is an afternoon of work, and on a GPU box it is an afternoon of work with a 40 GB model to re-validate afterwards.

How do I schedule it on a server you rarely log into?

A weekly cron entry is enough, and it is the only thing that turns this from a one-off cleanup into a habit:

# /etc/cron.d/pip-audit  (Mondays at 06:12, mail the report)
12 6 * * 1 root /tmp/paudit-venv/bin/pip-audit --path /opt/ai-stack/lib/python3.13/site-packages --desc >> /var/log/pip-audit.log 2>&1

Two operational details from running it this way:

  • Audit the environment, not the tool. --path points at the deployed stack’s site-packages; the auditor itself lives in its own venv, so upgrading pip-audit never touches your model server.
  • Accept a risk explicitly if you decide to. --ignore-vuln PYSEC-2026-XXXX silences one advisory ID, so the audit still exits 1 for everything new while the one you have written off does not mask a fresh problem on every run.

When should you NOT bother?

  • Single-user hobby server, no inbound traffic. If nothing but you talks to the Open WebUI on your LAN and you are the only person who can log in, the realistic attack surface is your own laptop. The scan costs a minute; the upgrade costs an evening. Do the scan monthly, not daily.
  • Air-gapped or offline installs. The advisory lookup needs to reach PyPI (or an OSV mirror). This host reaches PyPI directly, so I could not test the fully offline path; a warmed ~/.cache/pip-audit or an internal mirror is the practical answer, and the -r mode is what you would run against the mirror.
  • Inside a container image you rebuild anyway. If your deployment is a fresh pip install on every boot, the packages are already current and the audit is a no-op — keep the requirements.txt check in CI and skip the runtime scan.
  • When you need a code scanner. pip-audit matches versions against published advisories. It will not find a bug in your own service. For that you want a code scanner, and this is the wrong tool.

Honest take

pip-audit is the rare security tool that is free, tiny, has no false-positive marketing, and tells you the exact version that fixes each problem. The output is unglamorous and the workflow is boring, which is exactly why it works: one command a week on a server you already run tells you whether the thing is quietly rotting.

The discipline that matters is pairing it with a decision. An audit that produces 63 lines and no plan is just anxiety. Sort the output by “do I fix this today” (a package with an internet-facing path and a fix one version away), “do I schedule this” (fixes that need a model reload), and “do I accept this” (advisories in packages you never import — pip-audit reports what is installed, not what you use, so a tree with dead packages will look worse than it is).

Pair it with hash-pinned installs so the versions you audited are the versions that get installed, and with our self-hosted maintenance hours if you want to know what an upgrade cycle costs in wall-clock time.

Sources

Last updated November 22, 2026. Every command, exit code, advisory ID and fix version above was produced by running pip-audit 2.10.1 on November 22, 2026 against purpose-built virtual environments; advisory data changes daily, so re-run the scan rather than trusting these numbers later. No model was downloaded, no GPU was used, no paid service was involved.

Was this article helpful?

What self-hosting actually costs

Real cost breakdowns for self-hosted AI: hardware floors, power, maintenance hours, and the honest comparison against paying for it. No spam, unsubscribe anytime.