DEV Community

Samuel Rojas
Samuel Rojas

Posted on AI-assisted

I checked 422 security alerts in 5 Python projects: does the fix touch code the app even loads?

When Dependabot or pip-audit warns you about a vulnerability, the alert names the package. It doesn't tell you if the broken code runs in your app. I wanted to know that, so I measured it.

The case that made me ask

urwid had an advisory this year (CVE-2026-103022). The fix, commit b79d9a9, changes a single file: urwid/display/web.py. That's the part of urwid that serves its interface over the web.

In mitmproxy, bumping urwid to 4.0.7 to close that alert broke mypy with 63 errors. And mitmproxy never loads urwid/display/web.py: it imports urwid, but that file only loads if something uses urwid.web_display. I checked by running the code.

In other words: the fix broke the project to close a hole in code that never even ran.

How I measured it

I added a new option to depquiet, an open source tool I'm building: --fix-evidence. For each Python alert it does this:

  1. Finds the commit that fixes the advisory. Of the 2,746 PyPI advisories GitHub reviewed in 2026, 1,639 (60%) link one.
  2. Looks at which files that commit changed.
  3. Checks, in the project's environment, whether your code loads those files: what you import, what that imports, and what can load later (an import inside a function, a plugin loaded by name). It hides no alert. It just adds a line under each one with the evidence:
🟢 fix changes urwid/display/web.py: your code imports urwid, which does not load
   urwid.display.web; only using urwid.display.web or urwid.web_display would, and nothing does.
Enter fullscreen mode Exit fullscreen mode

The results

I ran it on GitHub Actions over 8 well-known projects, each at a pinned commit.

Project Alerts Loaded Can load later Not loaded Can't tell No fix commit
posthog 257 163 12 17 25 40
langflow 83 25 27 12 18 1
mitmproxy 51 15 3 30 0 3
mlflow 24 0 2 11 9 2
saleor 7 7 0 0 0 0
Total 422 210 44 70 52 46

mealie and paperless-ngx had no Python alerts at all (I double-checked against PyPI). zulip couldn't be measured because its environment didn't install.

Of the 324 alerts with a verdict:

  • 65% touch code the app does load.
  • 14% touch code that can load later.
  • 22% touch code the app never loads. 59 of those 70 are tools the projects run as commands, not imports: virtualenv, filelock, datamodel-code-generator, pytest. ## What I didn't expect

I thought it would show that most alerts don't matter. It showed the opposite: two in three fixes touch code that loads.

So this isn't a way to ignore alerts. It's a way to know which ones to handle first, and why the others don't apply.

The 4 mistakes I found before publishing

I checked the results by hand every round. I found 4 cases where depquiet said "not loaded" and the code did load:

  1. Plugins. virtualenv registers its own plugins, and depquiet counted them even when nothing loaded virtualenv. Now they only count if something loaded reads that plugin group.
  2. Pillow. It loads its format plugins (TIFF, EPS...) by name when you open an image. The names live in one file and the import in another.
  3. Chains. PdfParser is loaded by PdfImagePlugin, which itself loads later. Whatever a later-loaded module imports counts too.
  4. dnspython. It builds the module name (dns.rdtypes.IN.WKS) from the names of an enum, with no string anywhere. If a DNS server answers with that record type, the module loads. And an attacker can control that DNS answer. I fixed all of them before making the table. I'd rather have a lower number that's true.

The limits

  • Python only, for now.
  • Module level: if the file loads, it counts, even if the broken function is never called.
  • It looks at imports, not commands. If your CI runs tox, tox uses virtualenv even though your code doesn't import it.
  • It's static: a plugin picked at run time isn't seen. ## Try it on your project
uvx --with pip-audit depquiet --fix-evidence
Enter fullscreen mode Exit fullscreen mode

On a uv project you don't need a .venv: it builds a temporary one from uv.lock and removes it when done. Your folder stays as it was.

Full data and method: docs/fix-evidence.md

If you run it on your project, I'd love to hear what you get, especially if you find a wrong verdict.

Top comments (0)