Skip to content

Commit ae537fb

Browse files
authored
Merge pull request #348 from sleightsec/include-pipenv-hashes-without-index-attribute
fix: remove check for `index==pypi` which causes hashes to be excluded from the resultant BOM when using PipEnv Parser
2 parents 194d287 + b9ab033 commit ae537fb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cyclonedx_py/parser/pipenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, pipenv_contents: str) -> None:
4444
type='pypi', name=package_name, version=str(package_data.get('version') or 'unknown').lstrip('=')
4545
)
4646
)
47-
if package_data.get('index') == 'pypi' and isinstance(package_data.get('hashes'), list):
47+
if isinstance(package_data.get('hashes'), list):
4848
# Add download location with hashes stored in Pipfile.lock
4949
for pip_hash in package_data['hashes']:
5050
ext_ref = ExternalReference(

tests/test_parser_pipenv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def test_with_multiple_and_no_index(self) -> None:
5050

5151
self.assertEqual('anyio', c_anyio.name)
5252
self.assertEqual('3.3.3', c_anyio.version)
53-
self.assertEqual(0, len(c_anyio.external_references), f'{c_anyio.external_references}')
53+
self.assertEqual(2, len(c_anyio.external_references), f'{c_anyio.external_references}')
54+
self.assertEqual(1, len(c_anyio.external_references.pop().hashes))
5455

5556
self.assertEqual('toml', c_toml.name)
5657
self.assertEqual('0.10.2', c_toml.version)

0 commit comments

Comments
 (0)