You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run cyclonedx-bom on a requirements file (a test fixture and also a private repository of mine) and found that when the version is empty, the library raises an error. The error was introduced after I replaced the requirements parser in CycloneDX/cyclonedx-python#327, and the affected line is:
According to the specification, the version field is not required/enforced.
$ cyclonedx-bom -r -i tests/fixtures/requirements-local-and-remote-packages.txt --format json
Traceback (most recent call last):
File "/somewhere/.pyenv/versions/3.9.6/bin/cyclonedx-bom", line 8, in<module>sys.exit(main())
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx_py/client.py", line 260, in main
CycloneDxCmd(args).execute()
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx_py/client.py", line 122, in execute
output.output_to_file(filename=output_filename, allow_overwrite=self._arguments.output_file_overwrite)
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx/output/__init__.py", line 102, in output_to_file
f_out.write(self.output_as_string().encode('utf-8'))
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx/output/json.py", line 117, in output_as_string
self.generate()
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx/output/json.py", line 67, in generate
bom_json = json.loads(self._specialise_output_for_schema_version(bom_json=bom_json))
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx/output/json.py", line 96, in _specialise_output_for_schema_version
bom_json = self._recurse_specialise_component(bom_json=bom_json)
File "/somewhere/.pyenv/versions/3.9.6/lib/python3.9/site-packages/cyclonedx/output/json.py", line 147, in _recurse_specialise_component
ifself.component_version_optional() and bom_json[base_key][i]['version'] == "":
KeyError: 'version'
I tried to run
cyclonedx-bom
on a requirements file (a test fixture and also a private repository of mine) and found that when the version is empty, the library raises an error. The error was introduced after I replaced the requirements parser in CycloneDX/cyclonedx-python#327, and the affected line is:cyclonedx-python-lib/cyclonedx/output/json.py
Line 154 in 9fce6bf
According to the specification, the
version
field is not required/enforced.@madpah @jkowalleck WDYT?
The text was updated successfully, but these errors were encountered: