-
Notifications
You must be signed in to change notification settings - Fork 27
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
[bug] SBOM generation with sbom:cyclonedx using "--requires" argument produces broken sbom #138
Comments
Thanks for reporting this @markvmk Maybe @hedtke who contributed this extension can provide more feedback about this. It seems you are right, and the code should differentiate both cases, when using a |
Hi. Yes, this was done more or less on purpose. When called only with the Within the graph, this UNKNOWN node has the I am not sure how to fix that. We could try to branch on this case, and omit this when no file is used. We would need to check with multiple SBOM clients whether they accept that. |
I am not sure if I understand completely. The The In both cases it seems the Or maybe the approach works only with the |
I think, at the moment, I treat both cases in the same way, thus one time using the virtual conanfile as root which generates an entity called UNKNOWN in the SBOM (the root). I was not aware that this creates problems |
I think we need to understand better. The SBOM is identical in both cases for dependencies, just the root is different. "metadata": {
"component": {
"author": "Conan",
"bom-ref": "BomRef.23799299611816604.711995208657742",
"name": "UNKNOWN.1847826091984",
"type": "library"
},
"timestamp": "2024-07-03T12:17:39.433832+00:00",
"tools": [
{ In the other case with "metadata": {
"component": {
"author": "<Put your name here> <And your email here>",
"bom-ref": "pkg:conan/[email protected]",
"description": "<Description of mypkg package here>",
"licenses": [
{
"license": {
"name": "<Put the package license here>"
}
}
],
"name": "mypkg",
"purl": "pkg:conan/[email protected]",
"type": "library",
"version": "0.1"
}, Note in the second case the "metadata": {
"component": {
"author": "Conan",
"bom-ref": "BomRef.42409095884590187.8917758652747707",
"name": "UNKNOWN.2876611447008",
"type": "library"
}, Maybe it should be possible to just completely drop the "root" node? |
In my case, when I use When I use a path to the recipe, the package that is described in the recipe is not listed in the components array, but instead it is set as component in the metadata section of the SBOM. Ideally, in both cases the produced output would be the same (I don't know if that is possible at the moment). Maybe removing the root node (cli) in case of Another problem that I see also at the moment is that if you generate the SBOM for the same package with |
No, I am afraid there is some misunderstanding here. When given a If you want to list that as a component you need to first |
Maybe I was not very specific above, but probably there is misunderstanding too. I will take the elfutils project as example. The first option is to use The second option is to use path to the recipe. I have local checkout of the conan-center-index and assuming that the terminal is navigated into the recipe dir for elfutils (conan-center-index/recipes/elfutils/all) I try to generate the SBOM as following: In the first variant the component that is included in metadata is UNKNOWN, and that is the one that creates problem when merging multiple SBOMs because it ends up in the components list in the merged SBOM. elfutils in this case is added in the components list of the SBOM. In the second variant I think the SBOM looks fine. The component in metadata is elfutils, and the components list does not contain elfutils in this case. I think (I might be wrong) that it would be also fine if in case of |
No, this is not really correct. In the second case, There are 2 different dependency graphs here. In the first case with My suggestion above to @hedtke was actually to remove the "root" component inside |
Maybe we can summon @jkowalleck, and ask for clarification about this item:
Many thanks! |
re: #138 (comment) I've seen your ping. Meanwhile, I would encourage you to join the CycloneDX slack workspace (invite) |
I am trying to generate SBOM for conan packages that are used in a project using the sbom:cyclonedx conan extension as specified in the docs.
In my case it is necessary to use the "--requires" option to provide a reference to the recipe for which I want to create SBOM. When doing so the generated SBOM looks broken where an unknown component is introduced in the SBOM output.
If the SBOM is generated by passing a path to the conan recipe of the project then the SBOM looks fine.
The same can be seen in the output provided in the README file for the extension.
The problem seems to be that the extension tries to set the component in metadata using the dependency graph root, which in case when "--requires" is used is always "cli" (I don't know what exactly that means). Since "cli" is not valid reference or package I always get UNKNOWN component in the produced SBOM.
The text was updated successfully, but these errors were encountered: