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
{{ message }}
Repository navigation
bump_spdx_document crashes with 'too many values to unpack' on an spdx_id containing more than one colon #901
If an element's spdx_id contains more than one colon, this raises ValueError: too many values to unpack (expected 2) instead of a meaningful error.
The project already anticipates this input: validate_spdx_id (validation/spdx_id_validators.py:57-61) explicitly rejects IDs with more than one colon with a clear message. But get_full_element_spdx_id is reached from bump_from_spdx2/{file,package,snippet}.py during bump_spdx_document, which can run without that validation — e.g. the pyspdxtools3 CLI's --novalidation flag, or any library caller invoking bump_spdx_document() directly. Parsers don't constrain the ID shape, so a malformed third-party SBOM reaches this line.
How to reproduce
fromspdx_tools.spdx.spdx_element_utilsimportget_full_element_spdx_idfromspdx_tools.spdx.modelimportFile, Checksum, ChecksumAlgorithmf=File(name="f", spdx_id="DocumentRef-x:SPDXRef-y:z",
checksums=[Checksum(ChecksumAlgorithm.SHA1, "a"*40)])
get_full_element_spdx_id(f, "https://ns", [])
# ValueError: too many values to unpack (expected 2)
Expected
A clear error identifying the malformed spdx_id — consistent with the message validate_spdx_id already produces — rather than an unpack error from an internal split().
I have a fix and a regression test ready and will open a PR referencing this issue.
Activity