Open tuananh opened 9 months ago
cc @imjasonh
i compared sbom generated by trivy and by apko.
turns out, trivy was expecting the container image artifact to contain a package (alpine os). and relationship of apko image , contain the said OS.
i tried adding os package and 1 relationship and it seems to work.
// packages
{
"name": "alpine",
"SPDXID": "SPDXRef-OperatingSystem-b234ff30fe4ada0f",
"versionInfo": "3.20.0_alpha20231219",
"downloadLocation": "NONE",
"filesAnalyzed": false,
"primaryPackagePurpose": "OPERATING-SYSTEM"
},
...
// relationship
{
"spdxElementId": "SPDXRef-Package-sha256-e13d8a4cf521332118ed60c661913f2f083790d8aa598b14f7617427996d631d",
"relatedSpdxElement": "SPDXRef-OperatingSystem-b234ff30fe4ada0f",
"relationshipType": "CONTAINS"
},
@imjasonh should we fix this in apko or in trivy? I'm leaning toward trivy but wdyt?
also posted to trivy for discussion https://github.com/aquasecurity/trivy/discussions/6172
@imjasonh @jonjohnsonjr friendly ping :)
trivy maintainer suggest that we implement the fix in here. to add a new element type (operating-system) like this
https://spdx.github.io/spdx-spec/v2.3/package-information/#724-primary-package-purpose-field
right now, for spdx we have container image
contains package
.
should we update it to
container image
contains os
os
contains package
what do you think? if it's ok, i will send a PR over.
Hi @tuananh were you able to find solution for this ?
using the following command to scan
if sbom is found, trivy will use sbom instead. https://github.com/aquasecurity/trivy/blob/main/docs/docs/target/container_image.md#sbom
output
I was expecting to see trivy able to find sbom and use that instead. however, it's still pulling image. if sbom is found, it will look sth like this
is there any thing specific about sbom generated by apko?