Skip to content

Commit aeb7039

Browse files
authored
fix(sbom): parse type framework as library when unmarshalling CycloneDX files (#7527)
1 parent d1d7132 commit aeb7039

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pkg/sbom/cyclonedx/testdata/happy/third-party-bom.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"bom-ref": "pkg:composer/pear/[email protected]",
49-
"type": "library",
49+
"type": "framework",
5050
"name": "pear/pear_exception",
5151
"version": "v1.0.0",
5252
"purl": "pkg:composer/pear/[email protected]"

pkg/sbom/cyclonedx/unmarshal.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ func (b *BOM) unmarshalType(t cdx.ComponentType) (core.ComponentType, error) {
166166
ctype = core.TypeContainerImage
167167
case cdx.ComponentTypeApplication:
168168
ctype = core.TypeApplication
169-
case cdx.ComponentTypeLibrary:
169+
// There are not many differences between a `library` and a `framework` components, and sometimes it is difficult to choose the right type.
170+
// That is why some users choose `framework` type.
171+
// So we should parse and scan `framework` components as libraries.
172+
case cdx.ComponentTypeLibrary, cdx.ComponentTypeFramework:
170173
ctype = core.TypeLibrary
171174
case cdx.ComponentTypeOS:
172175
ctype = core.TypeOS

0 commit comments

Comments
 (0)