Skip to content

Conversation

alper
Copy link

@alper alper commented Jun 29, 2024

The Github spdx JSON file I got looked like this:

CleanShot 2024-06-29 at 23 18 17@2x

The nesting trips up the parser entirely but is easily fixed.

@armintaenzertng
Copy link
Collaborator

Hi @alper, thanks for your contribution. Unfortunately, you forgot to sign-off your commit. Please remove your current commit and replace it with signed-off commit as described in point 5 of the contribution guideline.

Signed-off-by: Alper Çugun <github@alper.nl>
@alper alper force-pushed the remove-json-nesting branch from 461249d to 3558ea5 Compare July 26, 2024 09:33
Signed-off-by: Alper Çugun <github@alper.nl>
@alper
Copy link
Author

alper commented Jul 26, 2024

OK. That's done. Do I need to create a test case for this?

@armintaenzertng
Copy link
Collaborator

Tests are always welcome! :)

Also note that the pipeline is currently broken, will be fixed in #814

@armintaenzertng
Copy link
Collaborator

In addition to a test it might be good to not just silently parse non-conformant SBOMs such as these but alert the user that this was a faulty SBOM and that it has been parsed by discarding the top-level key.

@maxhbr
Copy link
Member

maxhbr commented Aug 22, 2024

I think what you are parsing is not the GitHub SPDX file, it is a response that contains the SPDX File under the key "sbom". It is not the responsibility of our tool to treat these responses like SPDX files. And it would start accepting non-valid files as SPDX.

Can you link to an example for us to observe the behaviour on github?

@maxhbr
Copy link
Member

maxhbr commented Aug 22, 2024

I just navigated to https://github.com/aboutcode-org/scancode-toolkit/network/dependencies and used the Export SBOM button and got a response containing the valid SPDX file without the surrounding "sbom" key. Are you using an API?

Thank you for your conrtibution, but I would close this for now. Please reopen if this is still valid.

@maxhbr maxhbr closed this Aug 22, 2024
@alper
Copy link
Author

alper commented Sep 5, 2024

Hi! Thanks for checking this.

You're right, if I write the sbom key to a file, I think it works:

 fs.writeFileSync( 'sbom/choco-backend.json', JSON.stringify(response.data.sbom, null, 2) ); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants