GenerateFromDependency without CPE or PURL #373
Merged
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.
Summary
Currently, it's not possible to use
GenerateFromDependency()
in paketo-buildpacks/vsdbg#1 because thevsdbg
dependency has neither a CPE nor a PURL and 'GenerateFromDependency()' fails if the dependency lacks a CPE. With this change, the function generates an SBOM when the CPE is absent. The tests also assert that SBOM generation succeeds without a PURL.As you can see in the test assertions, for SPDX and Syft SBOMs, when the dependency CPE is empty, the SBOM output gets
cpe:2.3:-:-:-:-:-:-:-:-:-:-:-
for its CPE. As far as I can gather from the CPE Naming Spec 2.3, this means that every attribute of the software gets the value "NA" or Not Applicable.My understanding is that consumers will compare CPEs in SBOMs to CPEs in published vulnerability notices. If the CPEs in an SBOM match the CPEs for a vulnerability, the software is deemed vulnerable. The CPE Matching Spec 2.3 describes how tools are supposed to compare CPEs to understand whether a given piece of software contains a vulnerability.
From what I can tell in that document, assigning an "all N/A" CPE to dependencies with unknown CPEs is our best way to avoid false positives. We don't want a dependency with unknown CPE to set off alarms that it's vulnerable to CVEs in unrelated packages, (or, even worse, CVEs in all packages.)
✋ Help
The naming spec and matching spec are dense. I'd appreciate a second set of eyes to confirm if my choice of
UnknownCPE
makes sense.Todo:
UnknownCPE
once its value is confirmedChecklist