Modifications to Sbom reports - with Static reachability data
Background
As part of the Static Reachability feature after matching each package from the Advanced SAST results to packages, it is necessary to mark the package in the DS analyzer as imported and/or in use.
Implementation Plan
-
Add a new Propertiesfield to the cyclonedx.Component struct.This
Propertiesfield corresponds toCycloneDXcomponents[].properties and contains an array ofPropertyobjects with string fieldsNameandValue. -
Add the new Propertiesfield to the sbom.component with the followingNameandValue:-
Name:reachability -
Value: one of-
not_available: The default value, indicating the package is neither imported nor in use. -
in_use: Indicates the package is both imported and in use.
-
Note: the above
NameandValuefields were implemented in Add reachability attribute to Gemnasium depende... (gitlab-org/security-products/analyzers/gemnasium!835 - merged) • Joey Khabie • 17.3, however, we later decided to do the following:- Change
Namefromreachabilitytogitlab:dependency_scanning_component:reachability. - Change
Valuefromnot_availabletounknown. - Remove
in_useoption fromValue.
This was implemented in a follow-up issue: Add namespace to Gemnasium CycloneDX reachabili... (#482442 - closed) • Joey Khabie • 17.4
-
-
Add unit tests for the above changes.
Example
The old version:
[
{
"name": "MarkupSafe",
"version": "2.1.5",
"purl": "pkg:pypi/MarkupSafe@2.1.5",
"type": "library",
"bom-ref": "pkg:pypi/MarkupSafe@2.1.5"
},
New version:
[
{
"name": "MarkupSafe",
"version": "2.1.5",
"purl": "pkg:pypi/MarkupSafe@2.1.5",
"type": "library",
"bom-ref": "pkg:pypi/MarkupSafe@2.1.5",
"properties": [
{
"name": "reachability",
"value": "not_available"
}
]
},
cc- @or-gal