Repository navigation
Description
Describe the bug
When generating an SBOM from requirements, poetry, or pipenv inputs, cyclonedx-py strips user:password@ credentials from index, VCS, and download URLs (added in #646 / #647), but leaves single-token userinfo (https://<token>@..., with no :) unredacted in externalReferences, purl qualifiers, and description. Single-part token URLs without a password or colon are documented in pip's authentication guide (https://[email protected]/simple) and are also standard for HTTPS Git PAT URLs (git+https://<token>@github.com/org/repo.git).
By contrast, pip strips single-token userinfo when recording PEP 610 direct_url.json, so cyclonedx-py environment omits the token while cyclonedx-py requirements (and poetry / pipenv) retains it.
To Reproduce
- Create
requirements.txt:
--index-url https://[email protected]/simple/
requests==2.32.3
six @ git+https://[email protected]/benjaminp/[email protected]
- Run:
cyclonedx-py requirements requirements.txt --output-reproducibleExpected behavior
Single-token HTTP/HTTPS credentials are stripped from emitted URLs, PURLs, and descriptions just like user:password@ credentials:
https://pypi.company.com/simple/requests/requirements line 3: six @ git+https://github.com/benjaminp/[email protected]git+https://github.com/benjaminp/[email protected]pkg:pypi/six?vcs_url=git%2Bhttps://github.com/benjaminp/six.git%401.16.0
Screenshots or output-paste
Actual output (components section):
"components": [
{
"bom-ref": "requirements-L2",
"description": "requirements line 2: requests==2.32.3",
"externalReferences": [
{
"comment": "implicit dist url",
"type": "distribution",
"url": "https://[email protected]/simple/requests/"
}
],
"name": "requests",
"purl": "pkg:pypi/[email protected]",
"type": "library",
"version": "2.32.3"
},
{
"bom-ref": "requirements-L3",
"description": "requirements line 3: six @ git+https://[email protected]/benjaminp/[email protected]",
"externalReferences": [
{
"comment": "explicit dist url",
"type": "vcs",
"url": "git+https://[email protected]/benjaminp/[email protected]"
}
],
"name": "six",
"purl": "pkg:pypi/six?vcs_url=git%2Bhttps://ghp_0123456789abcdef%40github.com/benjaminp/six.git%401.16.0",
"type": "library"
}
],Environment
- cyclonedx-py version:
9.0.0(PyPIcyclonedx-bom==9.0.0) andmain(087a93338905b6c3b4169cb8c35721b442c23ae4) - Python version:
Python 3.11.2 - OS: Debian GNU/Linux 12 (bookworm), x86_64
Additional context
In cyclonedx_py/_internal/utils/secret.py, _URL_AUTH_MATCHER = re_compile(r'(?<=://)[^/@:]+:[^/@]+@') requires a : in the userinfo segment, so token@host never matches (note that PEP 610 exempts ${ENV_VAR} placeholders and git@ in SSH VCS URLs such as ssh://[email protected]/...).
Contribution
- I am willing to provide a fix
- I will wait until somebody else fixes it
Credit: https://ucsbplse.github.io/
Activity
jkowalleck commentedon Nov 25, 2026
thanks for the report.
Ticket seams pretty clear and properly scoped - ready to be picked up by anybody interested in contributing.
jkowalleck commentedon Nov 30, 2026
fixed per https://github.com/CycloneDX/cyclonedx-python/releases/tag/v9.0.1