fix(sbom): improve logic for determining Application type and filepath for non-Trivy SBOMs#10301
Draft
DmitriyLewen wants to merge 7 commits intoaquasecurity:mainfrom
Draft
Conversation
- check purl to detect app type - check `files` array to detect app filePath
Contributor
Author
|
Reopened from #8965 after recreating the fork. |
Contributor
|
This PR is stale because it has been labeled with inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We currently detect
Applicationtype frompropertiesonly.FilePath for Application can be detected from component
nameonly.This PR adds new logic:
purl(if exists)Filesarray.Example:
test file:
{ "SPDXID": "SPDXRef-DOCUMENT", "spdxVersion": "SPDX-2.3", "creationInfo": { "created": "2025-05-06T20:07:04Z", "creators": [ "Organization: Broadcom Inc. and/or its subsidiaries." ] }, "name": "SPDX document for Harbor 2.13.0", "dataLicense": "CC0-1.0", "documentDescribes": [ "SPDXRef-Application-harbor-exporter" ], "documentNamespace": "pkg:bitnami/harbor-exporter@2.13.0-3?arch=arm64&distro=debian-12", "packages": [ { "SPDXID": "SPDXRef-Application-harbor-exporter", "name": "harbor-exporter", "versionInfo": "2.13.0-3", "downloadLocation": "git+https://github.com/goharbor/harbor#refs/tags/v2.13.0", "licenseConcluded": "Apache-2.0", "licenseDeclared": "Apache-2.0", "filesAnalyzed": false, "externalRefs": [ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", "referenceLocator": "cpe:2.3:*:harbor-exporter:harbor-exporter:2.13.0:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", "referenceLocator": "pkg:bitnami/harbor-exporter@2.13.0-3?arch=arm64&distro=debian-12" } ], "copyrightText": "NOASSERTION" }, { "name": "github.com/CloudNativeAI/model-spec", "SPDXID": "SPDXRef-Package-768cb671cc7ce0ba", "versionInfo": "v0.0.3", "supplier": "NOASSERTION", "downloadLocation": "NONE", "filesAnalyzed": false, "sourceInfo": "opt/bitnami/harbor-exporter/bin/harbor_exporter", "licenseConcluded": "NOASSERTION", "licenseDeclared": "NOASSERTION", "externalRefs": [ { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", "referenceLocator": "pkg:golang/github.com/cloudnativeai/model-spec@v0.0.3" } ], "primaryPackagePurpose": "LIBRARY", "copyrightText": "NOASSERTION" } ], "files": [ { "fileName": "opt/bitnami/harbor-exporter/bin/harbor_exporter", "SPDXID": "SPDXRef-File-7b0411c48a1a7bf5", "checksums": [ { "algorithm": "SHA1", "checksumValue": "fd545010529c738b4fe0caff1922b99a0ab5f2e5" } ], "copyrightText": "" } ], "hasExtractedLicensingInfos": [], "relationships": [ { "spdxElementId": "SPDXRef-DOCUMENT", "relationshipType": "CONTAINS", "relatedSpdxElement": "SPDXRef-Application-harbor-exporter" }, { "spdxElementId": "SPDXRef-Application-harbor-exporter", "relatedSpdxElement": "SPDXRef-File-7b0411c48a1a7bf5", "relationshipType": "CONTAINS" }, { "spdxElementId": "SPDXRef-Application-harbor-exporter", "relatedSpdxElement": "SPDXRef-Package-768cb671cc7ce0ba", "relationshipType": "DEPENDS_ON" } ] }Before:
After:
Checklist