Repository navigation
Description
Describe the bug
When generating an SBOM from Pipfile.lock with cyclonedx-py pipenv, local file and path dependencies omit purl, but local VCS dependencies (such as "git": "git+file:///..." or "git": "file:///..." written by pipenv lock for a local Git repository) are emitted with a pkg:pypi/... PURL (and a bare pkg:pypi/<name> when --short-PURLs is passed).
By contrast, cyclonedx-py environment omits purl when PEP 610 direct_url.json has a file:// URL, including local VCS installs.
To Reproduce
- Create
Pipfile.lock(matching the lockfile entry written bypipenvfor a local Git repository):
{
"_meta": {
"hash": {
"sha256": "ebffa69a1fa192d1cef7cb42ad79231ca976565c5ce371a70160b3048d3cbc06"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"my-project": {
"git": "git+file:///home/user/projects/my-project",
"ref": "da59ad000d1405eaecd557175e29083a87d19f7c"
}
},
"develop": {}
}- Run:
cyclonedx-py pipenv . --output-reproducibleExpected behavior
purl is omitted for my-project because its VCS location points to a local file:// repository rather than a published package, matching local file/path entries in cyclonedx-py pipenv and local file:// VCS installs in cyclonedx-py environment.
Screenshots or output-paste
Actual output (components section):
"components": [
{
"bom-ref": "my-project",
"externalReferences": [
{
"comment": "from git",
"type": "vcs",
"url": "git+file:///home/user/projects/my-project#da59ad000d1405eaecd557175e29083a87d19f7c"
}
],
"name": "my-project",
"properties": [
{
"name": "cdx:pipenv:category",
"value": "default"
}
],
"purl": "pkg:pypi/my-project?vcs_url=git%2Bfile:///home/user/projects/my-project%40da59ad000d1405eaecd557175e29083a87d19f7c",
"type": "library"
}
],(With --short-PURLs, purl becomes "pkg:pypi/my-project".)
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/pipenv.py, PipenvBB.__is_local() already checks maybe_schema == 'file' or maybe_schema.endswith('+file') (with # - git+file:///home/user/projects/MyProject in its inline comment), but its initial if 'file' in data: / elif 'path' in data: guard returns False without inspecting VCS keys via self.__package_vcs(data) (git, hg, svn, bzr).
Contribution
- I am willing to provide a fix
- I will wait until somebody else fixes it
Credit: https://ucsbplse.github.io/
Activity
[-][BUG] pipenv subcommand emits pkg:pypi/ PURLs for local VCS dependencies in Pipfile.lock[/-][+]pipenv subcommand emits VCS PURLs fir affected dependencies in Pipfile.lock[/+]jkowalleck commentedon Nov 26, 2026
not a bug, more of a feature lack
pinsara23 commentedon Nov 26, 2026
Hi, I'd like to work on this. In PipenvBB.__is_local(), I'd fall through to __package_vcs(data) when there's no file/path key, so VCS URLs go through the existing file/+file scheme check. Remote VCS deps (git+https://…) keep their PURL. For tests, should I add a git+file entry to the existing pipenv/local fixture, or create a new fixture?
[-]pipenv subcommand emits VCS PURLs fir affected dependencies in Pipfile.lock[/-][+]pipenv subcommand emits VCS PURLs for affected dependencies in Pipfile.lock[/+][-]pipenv subcommand emits VCS PURLs for affected dependencies in Pipfile.lock[/-][+]pipenv subcommand emits insufficient VCS PURLs for affected dependencies in Pipfile.lock[/+]jkowalleck commentedon Nov 30, 2026
This proposed solution shall be discussed.
proposed solution
for VCS Purls:
vcs_urlpinsara23 commentedon Nov 30, 2026
Thanks, that makes sense. I'll change the approach: keep the PURL for local VCS dependencies, but omit the
vcs_urlqualifier when the VCS location is local (file:/+file:schemes). Remote VCS dependencies keepvcs_urlas before. I'll update this PR accordingly once the testbed PR is merged.jkowalleck commentedon Nov 30, 2026
new test data will be added per #1163