Scan the requirements.txt family and attribute CBOM algorithms to dependencies - #3
Merged
Merged
Conversation
…endencies
Manifest discovery matched the exact filename requirements.txt, so the
requirements-dev.txt and requirements-prod.txt split that most Python projects
use was never scanned. Match the requirements*.txt family and the
requirements/*.txt directory layout instead.
CBOM output emitted only the algorithm, carrying the dependency's version but
never its name, so a component reading {"name": "RSA", "version": "1.3.2"}
could not be traced to the library that provided it. Emit each dependency as its
own library component with a bom-ref and link algorithms to it through the
CycloneDX dependencies graph.
Reproducing those two also surfaced a silent false negative. pyproject.toml and
Pipfile were advertised as supported, but parsing fell through to the
requirements.txt line parser behind a TODO. A pyproject.toml produced
dependencies named after TOML keys, and because the real packages were never
identified, a project depending on cryptography reported no cryptographic usage
at all. Both formats now have real TOML parsers covering PEP 621, Poetry and
Pipfile layouts.
Also fixed: generateUUID returned a hardcoded all-zero UUID, so every CBOM
shared a serial number that did not match the CycloneDX urn:uuid pattern;
unresolved Maven properties such as ${java-jwt.version} and version ranges such
as >=2.0 were emitted where CycloneDX expects a concrete version; and primitive
values were outside the CycloneDX enum, failing schema validation for the whole
document.
Verified the emitted CBOM against the official CycloneDX 1.6 schema.
Fixes #1
Fixes #2
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1. Fixes #2.
#1:
requirements-*.txtskipped (@XeniaGabriela)Manifest discovery matched the exact filename
requirements.txt, so therequirements-dev.txt/requirements-prod.txtsplit that most Python projectsuse was never scanned. Now matches the
requirements*.txtfamily and therequirements/*.txtdirectory layout.#2: CBOM had no reference to the owning dependency (@SilverXen)
Output emitted only the algorithm, carrying the dependency version but never its
name, exactly as reported. Each dependency is now its own
librarycomponentwith a
bom-ref, and the CycloneDXdependenciesgraph links each algorithm tothe library providing it:
Your second example also showed
"version": "${java-jwt.version}". Anunresolved build property is not a version, and neither is a range like
>=2.0where CycloneDX expects a concrete version. Only pinned versions are now
reported as versions; the declared constraint is preserved in the component
description rather than dropped.
Found while reproducing: a silent false negative
pyproject.tomlandPipfilewere listed as supported formats, butParsefell through to the
requirements.txtline parser behind aTODO. Parsing anormal pyproject.toml produced five fabricated dependencies named after TOML
keys:
Because the real packages were never identified, the tool reported:
for a project that depends on
cryptographyandpyjwt. That is a falsenegative on the tool's core purpose. Both formats now have real TOML parsers
covering PEP 621, Poetry (including
[tool.poetry.group.*.dependencies]andinline tables) and Pipfile. The same project now correctly reports RSA, ECDSA,
Ed25519, RS256, ES256, AES, HS256 and ChaCha20.
Also fixed
generateUUIDreturned a hardcoded all-zero UUID, so every CBOM shared aserial number and the value did not match the CycloneDX
urn:uuidpattern.primitivevalues were outside the CycloneDX enum, which fails schemavalidation for the entire document.
The emitted CBOM was validated against the official CycloneDX 1.6 schema and
reports 0 violations.
Testing
Regression tests cover manifest discovery, all three Python formats, PEP 508
requirement parsing (extras and environment markers), CBOM attribution, version
resolution, serial number uniqueness, and primitive enum conformance.
Adds
github.com/BurntSushi/toml.