cdxgen: Unable to create SBOM with CDXGen 11
Hello,
I’m attemping to create an SBOM for an open source project (https://github.com/aws-solutions/connected-mobility-solution-on-aws for example) with the latest version of CDXGen and no SBOM is being generated.
When I use version 10 (specific version currently 10.2.6), the SBOM is generated.
Command used:
CDXGEN_DEBUG_MODE=debug FETCH_LICENSE=true cdxgen -t universal --spec-version 1.5 -o bom-1.5.json
No error is output, just returns to a prompt and no file is generated.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (13 by maintainers)
Commits related to this issue
- Fixes #1541 #1550 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> — committed to CycloneDX/cdxgen by prabhu 2 years ago
- Ruby repo tests (#1558) * Ruby repo tests Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Fixes #1541 #1550 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Improve u... — committed to emcfins/cdxgen by prabhu 2 years ago
It looks like it’s casting the
evidence.identityto an Array, then iterating through it to add appropriate methods.I was thinking that the boolean value of
Array.isArray(comp.evidence.identity);could be saved as a variable then after the logic is completed, cast it back to an object with something like:Do you think that would accomplish the goal of the logic here or am I missing something that could cause adverse effects elsewhere?
Ok - I think I found it. It’s happening in this logic: https://github.com/CycloneDX/cdxgen/blob/459dfe1e11dbe12f40d6a76103262d3988ac2014/lib/cli/index.js#L6029
Being called from here https://github.com/CycloneDX/cdxgen/blob/459dfe1e11dbe12f40d6a76103262d3988ac2014/lib/cli/index.js#L6093
Called from
createContainerSpecLikeBomhere: https://github.com/CycloneDX/cdxgen/blob/459dfe1e11dbe12f40d6a76103262d3988ac2014/lib/cli/index.js#L5078What’s the intended outcome?
Ok - I’ll look into it. Thank you!
Thank you. Since it is merged, please test with the master branch.
Well done! Please share a pull request once you are happy.
I think I found the other part for the validation issue!
I think this: https://github.com/CycloneDX/cdxgen/blob/0f1a142123a638c6ea1013c03e00d7a179ac6375/lib/cli/index.js#L4953
Should be:
Still have to dig deeper into the license issue
I’m not quite at the bottom of what the root cause of either issue but this is what I know so far.
For the just stopping with out error issue I’m running into, it has something to do with fetching the license for the
https://api.github.com/repos/cowboy/node-exitpackage but haven’t quite figured out WHAT about that is causing it to fail silently but it’s pretty consistently stopping at that package.For the validation error, it’s because the specVersion isn’t included in the options sent for that package (it’s from a docker image, not sure if that matters).
The options passed to the
addComponentfunction for thepkg:npm/npm@10.8.2package are:Since the version is missing, it’s not true for the if statement
if (options.specVersion < 1.6)because it’sundefinedand thus doesn’t get removed.From looking at your command I saw what was going on - I was missing the final
.in the command so it became:CDXGEN_DEBUG_MODE=debug FETCH_LICENSE=true cdxgen -t universal --spec-version 1.5 -o bom.json .Once I did that, it ran but I’m also getting a validation error - different from what you found: