Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPDX2.2: bom generates SBOM with invalid value for packageVerificationCodeValue #230

Closed
surendrapathak opened this issue Feb 13, 2023 · 0 comments · Fixed by #243
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/release Categorizes an issue or PR as relevant to SIG Release.

Comments

@surendrapathak
Copy link

surendrapathak commented Feb 13, 2023

What happened:

While applying quality checks on SBOMs, I found bom failing to adhere to the strict 2.2 spec for json format

bom generate --format json -i busybox > bom.spdx.json

results in the attached file with the invalid field -

"packageVerificationCode": {
        "packageVerificationCodeValue": ""
      }

However, this is a required field with a non-empty value when filesAnalyzed is true and for the attached SBOM, the field should be skipped (filesAnalyzed: false)

https://spdx.github.io/spdx-spec/v2.2.2/package-information/#79-package-verification-code-field

This causes other tools that rely on strict checks (such as [https://github.com/spdx/tools-python/blob/72780a48d830b29c5d8c85c27e9ddbf39c22b6f6/spdx/utils.py#L37-L39](https://github.com/spdx/tools-%5Bpython/blob/72780a48d830b29c5d8c85c27e9ddbf39c22b6f6/spdx/utils.py#L37-L39%5D(https://github.com/spdx/tools-python/blob/f934ae27cc76c20f8e701bf2503e3ea521a9bb88/spdx/parsers/jsonyamlxml.py#L1295))) to barf.

What you expected to happen:

packageVerificationCode with valid values or omitted

How to reproduce it (as minimally and precisely as possible):

bom generate --format json -i busybox > bom.spdx.json

Anything else we need to know?:

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Others:
    bom.spdx.json.txt
@surendrapathak surendrapathak added kind/bug Categorizes issue or PR as related to a bug. sig/release Categorizes an issue or PR as relevant to SIG Release. labels Feb 13, 2023
@surendrapathak surendrapathak changed the title bom fails to adhere to SPDX spec for packageVerificationCode SPDX2.2: bom generates SBOM with invalid value for packageVerificationCodeValue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/release Categorizes an issue or PR as relevant to SIG Release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant