← Back to Home

pip-audit's SBOM: Five Things Downstream Never Gets

supply chain securityPythonSBOM

TL;DR: pip-audit -f cyclonedx-json produces a file that validates against the 1.4, 1.5, 1.6 and 1.7 CycloneDX schemas with zero errors. In that same file: 0 of 35 components carry a purl, 0 carry hashes, 0 carry licenses, all 35 dependencies entries are empty shells with 0 edges, and metadata holds a single timestamp. It works as an attachment to a vulnerability report. It does not work as an asset inventory. On the same environment, cyclonedx-py returns 35 purls and 39 edges.

The short version: this is an attachment, not an inventory

On 2026-11-09 I wrote about reading pip-audit 2.10.1 scan output, and I closed that piece by saying I had not touched its CycloneDX output. This is the follow-up. It is not another article about reading vulnerabilities. It is about what a downstream consumer can actually do with the file once you hand it over.

The conclusion up front: pip-audit's CycloneDX output is format-valid but semantically thin. It is not a broken file. The schema accepts it, tools can parse it, every field name is spelled correctly. It is an empty file, because every field a downstream consumer actually needs happens to be optional, and therefore all of them are blank.

Everything below was run on my own machine, with the commands and the raw output quoted.

Setup and the two commands

The target is a clean venv holding flask==3.1.3 and requests==2.34.2, plus pip-audit itself:

python -m pip_audit --format cyclonedx-json -o base.json --progress-spinner off

A second environment deliberately installs old releases (requests 2.19.0, Jinja2 2.11.2, urllib3 1.23, idna 2.7, chardet 3.0.4) so the vulnerabilities array has something in it.

Blank one: 35 components, 0 purls

The first BOM contains 35 components. The complete field set of each one is these four keys:

{"bom-ref": "BomRef.10813865932059208.4858470511441134",
 "name": "CacheControl", "type": "library", "version": "0.14.4"}

purl: 0 of 35. hashes: 0 of 35. licenses: 0 of 35. externalReferences: 0 of 35.

Why purl matters is spelled out in the official CycloneDX documentation under the purl field: "Asserts the identity of the component using package-url (purl)." It asserts *who* a component is, not what it is called. Without that assertion, the consumer has to guess by name.

The cost of guessing is visible inside this one file: it contains CacheControl, pip_api and boolean.py, three different spellings in the same BOM. Normalized through purl they become pkg:pypi/cachecontrol, pkg:pypi/pip-api and pkg:pypi/boolean.py. Whether to lowercase, whether to collapse underscores into hyphens, whether to keep the dot — you now have to implement PEP 503 normalization yourself. Get it wrong and nothing errors. The match simply fails, and one advisory silently slips past.

Blank two: 35 components, 0 dependency edges

This one hurts more than the missing purl. The file does contain a dependencies array with exactly 35 entries, so at a glance the graph looks built:

"dependencies": [
  {"ref": "BomRef.004782033393651575.9086783281722834"},
  {"ref": "BomRef.005548436256527678.8461533511536604"}
]

Thirty-five records, not one of them carries dependsOn. Edge count: 0. The graph is 35 isolated points.

The official specification page defines the dependency graph as "capable of representing both direct and transitive relationships." Isolated points represent neither.

The consequence is concrete: with this BOM you cannot answer "who pulled urllib3 in?" That is the first question anyone asks when triaging a vulnerability. Is it a direct dependency, or a transitive one through Flask or requests? The answer decides whether you edit requirements or wait for an upstream release. On the same machine and the same environment, cyclonedx-py 8.0.1 emits 39 dependsOn edges across those 35 nodes, and the Flask entry explicitly lists Jinja2, MarkupSafe, Werkzeug, blinker, click and itsdangerous. The data was always there. pip-audit just does not write it out.

Blank three: no tools in metadata, and no component either

The entire metadata object is:

{"timestamp": "2026-11-10T22:14:12.494737+00:00"}

One key.

The official specification describes BOM metadata as covering "the target component for which the BOM describes" and "the tools used to create the BOM." Neither is present.

Without tools, whoever receives the file cannot answer "which tool, which version, produced this?" Six months later during an audit, that is a broken link in the chain. Without metadata.component, nothing in the file says which project this BOM describes. It is a bag of packages with no owner.

In fairness: cyclonedx-py 8.0.1 does emit metadata.tools, but its metadata.component is null as well. A missing BOM subject is not unique to pip-audit, since cyclonedx-py environment skips it too. The missing tools entry is a real difference between the two.

Blank four: four vulnerability fields, and aliases that do nothing

The vulnerable BOM holds 38 vulnerabilities entries. The complete field set of each: id, description, recommendation, affects, bom-ref.

That is all.

This is documented behavior, not a bug. From pip-audit --help: both --desc and --aliases state "This flag has no effect on the cyclonedx-json or cyclonedx-xml formats." So searching this SBOM by CVE number depends on the prose happening to mention it, and it does so in 6 of 38 entries.

recommendation is hardcoded to Upgrade with no target version. Compare that with the JSON format covered in the 11-09 piece, where every vulnerability carries fix_versions. Same underlying data. Present in JSON, absent in the SBOM.

Blank five: local packages quietly dropped from the BOM

This is the one most likely to be waved through as fine. I put a single local directory line in a requirements file:

./localpkg

The -f json output is honest about skipping it:

{"name": "localdemo", "skip_reason": "Dependency not found on PyPI and could not be audited: localdemo (0.1.0)"}

Switch to -f cyclonedx-json and the output file contains six keys: metadata, serialNumber, version, $schema, bomFormat, specVersion. There is no components key at all. The console prints "No known vulnerabilities found" and the process exits 0.

The source has one line for this: if dep.is_skipped(): continue. A skipped dependency is dropped, not even left behind as an empty component.

So the layer of the project that is actually yours — a local package, an editable install of an internal library — is entirely absent from the SBOM, while the file remains valid, uploadable and schema-clean. An inventory that claims to describe your application while dropping your application is the kind of "passing" I trust least.

All four schemas pass, which is the actual danger

I fed the vulnerable file to the 1.4, 1.5, 1.6 and 1.7 schemas:

--- 1.4: 0 errors
--- 1.5: 0 errors
--- 1.6: 0 errors
--- 1.7: 0 errors

Four for four. The reason is simple: every field I listed above — purl, hashes, licenses, dependsOn, metadata.component, ratings, source, analysis — is optional. The only required top-level members are bomFormat and specVersion.

Which makes "the SBOM validates" a nearly content-free statement. It proves a parser can read the file. It does not prove the file contains anything. If the only gate in your CI is cyclonedx validate, that gate is a tautology for this artifact.

One environment, three numbers: 49, 38 and 25

This is the part I did not expect. On the old-version environment:

Eleven missing. I diffed them record by record. The cause: the JSON output contains each package's advisory twice, byte for byte identical (same id, same aliases, same description). The CycloneDX side stores vulnerabilities in a sorted set whose comparison key includes id, description and affects, so exact duplicates collapse.

The collapse is incomplete, though: those 38 entries contain only 25 unique advisory IDs. The other 13 are "same ID, different description" pairs — one OSV-native description, one GHSA-advisory style description. Description is part of the comparison key, so both survive.

Same machine, same environment, same audit run, three official outputs, three numbers: 49, 38, 25. Pick any one for your weekly report and someone can challenge it. My rule is to report the unique advisory count (25) and use the other two only to detect that a tool changed behavior.

specVersion pinned to 1.4: one line of source, three major versions behind

The file declares:

"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json", "specVersion": "1.4"

The official specification page currently lists 1.7, released 2025-10-21 and published as ECMA-424. pip-audit emits 1.4, three major versions back.

This is not an environment issue, it is hardcoded. From pip_audit/_format/cyclonedx.py:

schema_version=output.SchemaVersion.V1_4

Its own dependency, cyclonedx-python-lib 11.12.0, supports up to 1.7 (the SchemaVersion enum carries V1_7 down to V1_0). The library can produce 1.7; the caller pins 1.4.

How much that costs shows up in the schema definitions: the 1.7 vulnerability definition adds three fields over 1.4 (workaround, proofOfConcept, rejected), and component adds ten (authors, manufacturer, swhid, omniborId, modelCard and others). Questions like "is there a mitigation for this vulnerability" or "who manufactured this component" have no field to live in under 1.4.

Side by side: the same environment through cyclonedx-py

Same venv, same 35 components, two tools:

Itempip-audit 2.10.1cyclonedx-py 8.0.1
specVersion1.41.6
Components3535
With purl035
With licenses035
With externalReferences035
With hashes00
dependsOn edges039
metadata.toolsabsentpresent
metadata.componentabsentabsent (null)
bom-ref shapeBomRef plus random digitsCacheControl==0.14.4
vulnerabilitiespresent (4 fields)absent (environment mode)

The division of labor is clear: pip-audit gives you vulnerabilities, cyclonedx-py gives you the inventory. If you want one file that does both, you assemble it yourself.

One detail worth keeping: cyclonedx-py's bom-ref is CacheControl==0.14.4, stable and readable. pip-audit's is BomRef.10813865932059208.4858470511441134, different on every run. I ran the same environment twice: serialNumber differed, 0 of 8 component bom-ref values matched, and 0 of 25 vulnerability bom-ref values matched.

If your CI diffs the SBOM against a quarterly baseline and alerts on change, this file changes 100% every single time. The alert fires and tells you nothing.

--fix and CycloneDX are mutually exclusive: fixed, but invisible

I hit this one by accident. The command:

python -m pip_audit --path ENV_PATH --fix -f cyclonedx-json -o fix.json

The console:

Found 49 known vulnerabilities in 5 packages and fixed 49 vulnerabilities in 5 packages
WARNING:pip_audit._format.cyclonedx:--fix output is unsupported by CycloneDX formats

All 49 were genuinely fixed and the packages really were upgraded. But the SBOM contains no trace of the fix: no previous version, no new version, no fix_versions, and recommendation is still the bare word Upgrade.

The source line is logger.warning("--fix output is unsupported by CycloneDX formats"), so "unsupported" is communicated only as a log warning. If your wrapper script checks the exit code — 0 here — you will believe the post-fix SBOM was archived.

Four things to add before you hand this file over

1. Do not use pip-audit's SBOM as an inventory. For inventory run cyclonedx-py environment path-to-venv-python; for vulnerabilities run pip-audit. Cross-check the two by component count, which matched here at 35 to 35.

2. Add three integrity assertions instead of relying on schema validation: does every component carry a purl (the ratio should be 100%)? Is sum(len(dep.get("dependsOn", []))) greater than zero? Does metadata.component point at your project? If any answer is no, the file should not enter your artifact store.

3. Normalize before diffing. Strip serialNumber and every bom-ref, or the diff is a full rewrite every time.

4. Do not combine --fix with a CycloneDX format. Either run pip-audit --fix first and regenerate the SBOM, or use the JSON format to get fix_versions.

Troubleshooting: four errors, verbatim

Error 1: wrong format name, exit code 2

pip-audit: error: argument -f/--format: invalid OutputFormatChoice value: 'cyclonedx'

The valid values are columns, json, cyclonedx-json, cyclonedx-xml and markdown, per pip-audit --help. Typing cyclonedx is the most common slip; note these are two separate values, not a family.

Error 2: --require-hashes against a requirements file without hashes

ERROR:pip_audit._virtual_env:internal pip failure: ERROR: Hashes are required in --require-hashes mode,
but they are missing from some requirements.

The line opens with internal pip failure, which reads like a pip-audit bug. It is pip refusing to install into the temporary virtualenv. Either add --hash=sha256:... or drop --require-hashes. pip already printed the hashes you need, so copy them.

Error 3: requirements path does not exist

ERROR:pip_audit._cli:invalid requirements input: nope.txt

One ERROR line, no traceback, exit code 1. In a CI job that swallows stderr, this looks exactly like "the audit produced nothing."

Error 4: the -o directory does not exist, and the audit is wasted

Found 37 known vulnerabilities in 3 packages
Traceback (most recent call last):
  ...
FileNotFoundError: [Errno 2] No such file or directory: 'nodir\\x.json'

Note the order: it prints "found 37" first, then dies writing the file. The audit already ran, the network calls and the wall-clock time are spent, and the results are lost at the moment of writing. Exit code 1. pip-audit will not create the output directory for you.

One more, not an error but nastier: -f cyclonedx-xml -o xml-out.json writes XML verbatim into a .json filename, with exit code 1 (because vulnerabilities exist) and zero complaints. CycloneDX conventionally uses bom.json / bom.xml, or the *.cdx.json / *.cdx.xml suffix; many downstream tools pick a parser by extension, so a wrong name means a failed parse.

What this article does not cover

Being explicit about the gaps is worth more than three extra conclusions:

Writing this kept bringing me back to one judgment: format validity and information usability are two different things, and every automated gate checks only the first. I actually tested four schemas and all four reported zero errors, while the five fields downstream needs most were all empty.

No affiliate links in this article. To go back one layer, read how to read the scan results; to go one layer upstream, see where version pinning syntax stops; and if your question is whether a package writes outside the directory it was given, that is the extraction layer.

FAQ

Q: Can I upload a pip-audit SBOM straight to an SCA platform?

You can, and most platforms will parse it. But with no purl on any component, the platform matches on name plus version, and spelling differences like CacheControl versus cachecontrol depend on the platform's own normalization. Use cyclonedx-py output as the inventory and keep pip-audit output as the vulnerability attachment.

Q: specVersion is only 1.4. Will that break compatibility?

No. 1.4 is the most broadly supported version and older platforms accept it. The cost is that you cannot use fields added after 1.5 (workaround, proofOfConcept, rejected). If your process needs mitigation guidance, there is nowhere to put it in a 1.4 document.

Q: I only care about vulnerabilities. Do I still need an SBOM?

Yes, because the two answer different questions. The vulnerability report answers "what is broken." The SBOM answers "who brought it in, and which services are affected." The first decides whether you patch; the second decides which file to edit and which team to notify.

Q: Why did my local package disappear from the SBOM?

pip-audit marks dependencies it cannot resolve on PyPI as skipped. The JSON format records a skip_reason; the CycloneDX formatter simply skips them in source, leaving no trace and still exiting 0. Editable installs and internal private packages hit this most often.

Q: Two consecutive BOMs are completely different. Is that normal?

Yes. serialNumber is regenerated each run and bom-ref values are random strings. To compare content, strip both fields and index by name plus version.

👉 Join Xiaomi MiMo Platform: Leading AI model platform with cost-effective inference

👉 Join Aliyun AI: Top AI products with exclusive coupons for business innovation

📌 This article was AI-assisted generated and human-reviewed | TechPassive — An AI-driven content testing site focused on real tool reviews

🔗 Recommended Tools

These are carefully selected tools. Using our affiliate links supports us to keep producing quality content:

As an Amazon Associate, I earn from qualifying purchases at no extra cost to you.

☁️ DigitalOcean Cloud ⚡ Vultr VPS 🤖 QoderWork CN (Refer & Earn) ☁️ Aliyun AI Products 📚 WordPress Books 🧠 AI & LLM Books 🏗️ System Design Books 🐳 Docker & K8s Books 🐧 Linux Admin Books 🐍 Python Books 🗄️ Database Books 🚀 DevOps & SRE Books 🤖 Xiaomi MiMo Platform
← Back to Home