Repository navigation
Description
Summary
--format cyclonedx-* leaves every OS-ecosystem package out of the report, along with the vulnerabilities attached to those packages. A scan of a Debian-based image finds 88 Debian packages and 85 vulnerability IDs, but its CycloneDX output lists one component (pip) and an empty vulnerabilities array. The only other signal is one stderr warning per package and, when vulnerabilities exist, exit code 1.
Runtime or environment
- OSV-Scanner v2.7.0 from Homebrew (osv-scalibr 0.5.3), and
mainatdcbda879b9129945362b1513c08ed5c0282c374ebuilt withgo build ./cmd/osv-scanner - macOS arm64, scanning
linux/arm64image variants saved withcrane pull - Run on 2026-11-04. Vulnerability counts depend on OSV data at that time.
Steps to reproduce
crane pull --platform linux/arm64 python@sha256:e2dc9a4f015cd2409b9ce7d9b1d258f608851daa73ccf8d3f06ac6b80fc4a6c3 python.tar
osv-scanner scan image --archive --all-packages --format cyclonedx-1-5 python.tar > cdx.json 2> cdx.err; echo "exit $?"
jq -c '{components: [.components[].purl], vulnerabilities: (.vulnerabilities | length)}' cdx.json
grep -c 'Failed to parse package URL' cdx.err
osv-scanner scan image --archive --all-packages --format json python.tar > scan.json
jq -c '{debian_packages: ([.results[].packages[] | select(.package.ecosystem | startswith("Debian"))] | length), with_purl: ([.results[].packages[] | select(.package.ecosystem | startswith("Debian")) | select(.package.purl)] | length), vulnerability_ids: ([.results[].packages[].vulnerabilities[]?.id] | unique | length)}' scan.json
osv-scanner scan image --archive --all-packages --format spdx-2-3 python.tar > spdx.json
jq '[.packages[].externalRefs[]? | select(.referenceType == "purl")] | length' spdx.jsonThe digest pins a Python 3.15.2 slim image on Debian 13. The case has not been minimized.
Expected behavior
The CycloneDX report lists the OS packages the scan found and the vulnerabilities matched to them. docs/scan-image.md says output-format flags apply to scan image and that it scans for OS packages. The CycloneDX section of docs/output.md documents --format cyclonedx-1-5 --all-packages with no stated exclusion, and its sample includes components and vulnerabilities. The SPDX section states its own limit, that it omits vulnerability information.
Actual behavior
Both tested builds give the same result for the commands above:
exit 1
{"components":["pkg:pypi/pip@26.2.2"],"vulnerabilities":0}
88
{"debian_packages":88,"with_purl":88,"vulnerability_ids":85}
90
cdx.err has 88 lines of this form:
Failed to parse package URL: unable to determine purl type of adduser@3.152 (Debian:13)
The same scan's JSON output gives that package the purl pkg:deb/debian/adduser@3.152?arch=all&distro=trixie.
Without --all-packages, the CycloneDX report has 0 components and 0 vulnerabilities and the command still exits 1. cyclonedx-1-6 gives the same result as cyclonedx-1-5 on both tested builds. cyclonedx-1-4 and cyclonedx-1-7 give the same result on v2.7.0, the only build where I ran them.
Other images on v2.7.0, by index digest:
| Image | OS packages in JSON | Vulnerability IDs in JSON | CycloneDX components | CycloneDX vulnerabilities | Warnings |
|---|---|---|---|---|---|
alpine:3.22 (sha256:2e0b81d60597f449baa56dc25d355367869d2dca4cd57e866f1e2b52af3eb55f) |
16 | 0 | 0 | 0 | 16 |
ubuntu:24.04 (sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852) |
92 | 42 | 0 | 0 | 92 |
almalinux:9 (sha256:245f8aab832fe800aa42bdab5fad75ebbd8e0b4c9f24820a83c638b177857ae2) |
159 | 24 | 9 (all PyPI) | 23 | 159 |
As a control, scan source --all-packages on a directory holding a requirements.txt with jinja2==2.4.1 gives 1 CycloneDX component, 18 vulnerabilities and no warnings on v2.7.0, so the format reports vulnerabilities for an ecosystem it can map.
Evidence
- Expected source: the
docs/scan-image.mdanddocs/output.mdsections linked above. - Failure source: the executed runs above, with
FromPackageas the source of the warning text. It returns that error for any ecosystem missing fromEcosystemToPURLMapper, which lists only language ecosystems.Groupthen skips the package, andcycloneDXReporter.PrintResultlogs the error and returns nil. I read this path and did not test a patched build. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Restoration check
Today the steps above give 1 CycloneDX component and 0 vulnerabilities for this image. After restoration, the report should list the 88 Debian packages as components alongside pkg:pypi/pip@26.2.2, and every vulnerability ID from the JSON output should appear in vulnerabilities. As a control, the jinja2==2.4.1 source scan should keep its component and vulnerabilities, and an Alpine or Ubuntu image should also list its OS packages.
Additional context
The test suite already records this. internal/output/cyclonedx_test.go says "some packages cannot currently be represented (such as those from OS ecosystems which we cannot determine a PURL for), which is reported as an error after the rest of the output has been written", and its snapshots hold those errors. I found no statement of this limit in docs/output.md, docs/scan-image.md or docs/usage.md, which is why I am reporting it as a bug. The stated reason also no longer seems to apply to image scans, since the JSON output has a purl for all 88 Debian packages and the SPDX output has 90 purls including those packages. If the omission is meant to stay, users would still need it documented and a warning that names it, because "Failed to parse package URL" does not say the package was left out of the report.
References
- JSON output doesn't include purls for scanned packages #2874 and feat: include package purls in JSON output #2885 added purls to JSON output.
- refactor: centralize grouping in
grouperand makeoutputtests more correct #3138 added the test comment quoted above.
Triage assessment
- Impact level: P1
- Assessment status: supported
- Impact basis: For the four OS ecosystems tested, a CycloneDX report omits every OS package and its vulnerabilities, so a consumer that reads only the report sees 0 of the 85 vulnerability IDs on the Debian image. It affects CycloneDX output from scans containing OS packages; JSON and SPDX output kept those packages. Exit code 1 and stderr warnings remain, but neither is part of the report.
- Workaround status: none
- Workaround basis:
--format jsonkeeps the packages and vulnerabilities and--format spdx-2-3keeps the packages, but neither gives a CycloneDX consumer a CycloneDX document, and the code path above has no option that keeps these packages.
Activity
G-Rath commentedon Nov 4, 2026
yeah this format is broken in a few ways - I'm working on an internal task around putting together a plan for addressing that