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

SPDX SBOM not compliant to SPDX Scheme 2.2 #1596

Closed
MP91 opened this issue Feb 21, 2023 · 18 comments
Closed

SPDX SBOM not compliant to SPDX Scheme 2.2 #1596

MP91 opened this issue Feb 21, 2023 · 18 comments
Labels
bug Something isn't working

Comments

@MP91
Copy link

MP91 commented Feb 21, 2023

What happened:

We generated some SBOMs for our project. We need them as input for another tool in the SPDX format.

The tool reports an error because the generated document uses PACKAGE-MANAGER as reference category.

What you expected to happen:
PACKAGE_MANAGER is used
Steps to reproduce the issue:

Generate a SPDX SBOM of Ubuntu

Anything else we need to know?:

            "referenceCategory" : {
              "description" : "Category for the external reference",
              "type" : "string",
              "enum" : [ "OTHER", "SECURITY", "PACKAGE_MANAGER" ]

Environment:

  • Output of syft version: syft-0.72.0
  • OS (e.g: cat /etc/os-release or similar): Ubuntu 22
@MP91 MP91 added the bug Something isn't working label Feb 21, 2023
@kzantow
Copy link
Contributor

kzantow commented Feb 21, 2023

PACKAGE_MANAGER and PACKAGE-MANAGER should both be valid. See the latest schema: https://github.com/spdx/spdx-spec/blob/development/v2.3.1/schemas/spdx-schema.json#L322-L326

@MP91
Copy link
Author

MP91 commented Feb 22, 2023

@kzantow yes already saw this, but the notes say that the document is compliant to version 2.2 and this is also the version what our tool expects.

Edit I changed the title to better reflect this.

@MP91 MP91 changed the title SPDX SBOM not compliant to SPDX Scheme SPDX SBOM not compliant to SPDX Scheme 2.2 Feb 22, 2023
@kzantow
Copy link
Contributor

kzantow commented Feb 22, 2023

I've added an issue to the tools-golang library that we use, where I think this should be handled. It should be noted that the JSON schema is incorrect and not according to the spec. To deal with this, the advice to SPDX implementors is to accept both values.

@kzantow
Copy link
Contributor

kzantow commented Feb 22, 2023

I've also added a PR to correct the SPDX 2.2 JSON schema. I do not believe Syft should be generating JSON with values that contradict the spec, even if the JSON schema is different. Are there specific tools that are failing and could they be corrected to accept what should be the correct values?

@kzantow
Copy link
Contributor

kzantow commented Feb 22, 2023

Also, this is in direct conflict with the issue raised for which I think this change was made: #1236

@MP91
Copy link
Author

MP91 commented Mar 10, 2023

Hey @kzantow, thanks already for working on that one. Specifically we are using our own fork of the ORT (https://github.com/oss-review-toolkit/ort) to scan our code. They are still setting on SPDX 2.2, but I already raised an issue to update the version to 2.3.1. So far nothing happened...

@kzantow
Copy link
Contributor

kzantow commented Mar 14, 2023

FYI -- the latest v2.2 JSON schema should be updated to include PACKAGE-MANAGER -- my PR was merged: spdx/spdx-spec#836 hopefully tools are able to at least get this update and handle both values appropriately

@kzantow
Copy link
Contributor

kzantow commented Mar 14, 2023

Also FYI you can export an SPDX 2.2 version (which still includes PACKAGE-MANAGER) by appending @2.2 to the format, e.g.: -o spdx-json@2.2

@tgerla
Copy link
Contributor

tgerla commented Jun 1, 2023

Hi @MP91, I'm going to close this issue because I believe you have what you need...but if I am wrong, please let us know! Thanks.

@tgerla tgerla closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
@ShivamDalmia-eaton
Copy link

ShivamDalmia-eaton commented Feb 22, 2024

syft -o spdx@2.2 > sbom2.spdx and syft -o spdx-tag-value@2.2 > sbom2.spdx they both are still giving me spdx version 2.3 is there any way I can get 2.2 version?

@tgerla
Copy link
Contributor

tgerla commented Feb 22, 2024

Hi @ShivamDalmia-eaton, thanks for the report, I have reproduced this and will take a look with the team as soon as we can. (If it's useful, it appears as though -o spdx-json@2.2 correctly creates a JSON file of version 2.2.)

@ShivamDalmia-eaton
Copy link

ShivamDalmia-eaton commented Feb 22, 2024

Thanks @tgerla for the speedy reply my requirement is for a spdx file with 2.2 version if it's there any way to achieve that please do let me know..Thank you

@kzantow
Copy link
Contributor

kzantow commented Feb 22, 2024

Hi @ShivamDalmia-eaton; I had a look at why the SPDX Tag-Value version selection was not working and it was a pretty simple fix; I created a PR here: #2665

@ShivamDalmia-eaton
Copy link

Thanks @kzantow I'll look into it and inform you if it's working or not

@ShivamDalmia-eaton
Copy link

Hi @kzantow "syft -o spdx-tag-value@2.2 > sbom2.spdx" and "syft image.tar -o spdx@2.2 > sbom2.spdx" is still giving a 2.3 version is the command right?

@kzantow
Copy link
Contributor

kzantow commented Feb 23, 2024

@ShivamDalmia-eaton yes, the PR noted above needs to get merged and released to fix it.

@ShivamDalmia-eaton
Copy link

@kzantow thanks for the response if you can do let me know when the PR is reviewed and merged and the Tag-value version is fixed. Thanks

@kzantow
Copy link
Contributor

kzantow commented Feb 26, 2024

@ShivamDalmia-eaton this should be fixed in Syft v0.105.1:

% syft version
Application: syft
Version:    0.105.1
BuildDate:  2024-02-26T15:57:06Z
GitCommit:  Homebrew
GitDescription: [not provided]
Platform:   darwin/amd64
GoVersion:  go1.22.0
Compiler:   gc

% syft alpine:latest -o spdx@2.2
SPDXVersion: SPDX-2.2
DataLicense: CC0-1.0
SPDXID: SPDXRef-DOCUMENT
DocumentName: alpine
DocumentNamespace: https://anchore.com/syft/image/alpine-dc3d6acf-09d7-4414-b196-b1df531db658
...

... and sorry for the spam on this closed issue to any watchers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

4 participants