feat: add support for Bitnami cataloguer (#3341)

* prototype: start bitnami cataloger

Bitnami images have spdx SBOMs at predictable paths, and Syft could more
accurately identify the software in these images by scanning those
SBOMs. Start work on this by forking the sbom-cataloger as a new
bitnami-cataloger.

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>

* wire up bitnami cataloger to run on images by default

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>

* feat: add support for Bitnami cataloguer

Signed-off-by: juan131 <jariza@vmware.com>

* feat: use a better SPDX sample for unit tests

Signed-off-by: juan131 <jariza@vmware.com>

* bugfix: only report bitnami pkgs

Signed-off-by: juan131 <jariza@vmware.com>

* feat: adapt JSON schema, spdxutil and packagemetadata

Signed-off-by: juan131 <jariza@vmware.com>

* bugfix: integration tests

Signed-off-by: juan131 <jariza@vmware.com>

* feat: implement FileOwner interface

Signed-off-by: juan131 <jariza@vmware.com>

* bugfix: update json schema

Signed-off-by: juan131 <jariza@vmware.com>

* [wip] add bitnami owned files and fix binary package ownership filtering

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* feat: obtain bitnami pkg files based on SPDX relationships tree

Signed-off-by: juan131 <jariza@vmware.com>

* preserve type switches

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* rename bitnami entry metadata type

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* restrict find main pkg logic

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* add missing graalvm source info

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* bugfix: integration tests

Signed-off-by: juan131 <jariza@vmware.com>

* bugfix: mod tidy

Signed-off-by: juan131 <jariza@vmware.com>

---------

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>
Signed-off-by: juan131 <jariza@vmware.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Will Murphy <willmurphyscode@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Juan Ariza Toledano
2025-02-18 09:07:47 -05:00
committed by GitHub
co-authored by Will Murphy Alex Goodman
parent 869908ece1
commit bffe26bcc5
32 changed files with 4674 additions and 60 deletions
@@ -43,6 +43,10 @@ func Originator(p pkg.Package) (typ string, author string) { //nolint: funlen
case pkg.ApkDBEntry:
author = metadata.Maintainer
case pkg.BitnamiSBOMEntry:
typ = orgType
author = "Bitnami"
case pkg.DotnetPortableExecutableEntry:
typ = orgType
author = metadata.CompanyName
@@ -12,6 +12,7 @@ import (
func Test_OriginatorSupplier(t *testing.T) {
completionTester := packagemetadata.NewCompletionTester(t,
pkg.BinarySignature{},
pkg.BitnamiSBOMEntry{},
pkg.CocoaPodfileLockEntry{},
pkg.ConanV1LockEntry{},
pkg.ConanV2LockEntry{}, // the field Username might be the username of either the package originator or the supplier (unclear currently)
@@ -89,6 +90,14 @@ func Test_OriginatorSupplier(t *testing.T) {
originator: "",
supplier: "Person: someone",
},
{
name: "from bitnami",
input: pkg.Package{
Metadata: pkg.BitnamiSBOMEntry{},
},
originator: "Organization: Bitnami",
supplier: "Organization: Bitnami",
},
{
name: "from dotnet -- PE binary",
input: pkg.Package{
@@ -16,6 +16,8 @@ func SourceInfo(p pkg.Package) string {
answer = "acquired package info from RPM DB"
case pkg.ApkPkg:
answer = "acquired package info from APK DB"
case pkg.BitnamiPkg:
answer = "acquired package info from a Bitnami SBOM"
case pkg.DartPubPkg:
answer = "acquired package info from pubspec manifest"
case pkg.DebPkg:
@@ -32,6 +34,8 @@ func SourceInfo(p pkg.Package) string {
answer = "acquired package info from installed gem metadata file"
case pkg.GoModulePkg:
answer = "acquired package info from go module information"
case pkg.GraalVMNativeImagePkg:
answer = "acquired package info from GraalVM native image"
case pkg.RustPkg:
answer = "acquired package info from rust cargo manifest"
case pkg.PhpComposerPkg:
@@ -111,6 +111,14 @@ func Test_SourceInfo(t *testing.T) {
"from go module information",
},
},
{
input: pkg.Package{
Type: pkg.GraalVMNativeImagePkg,
},
expected: []string{
"from GraalVM native image",
},
},
{
input: pkg.Package{
Type: pkg.RustPkg,
@@ -199,6 +207,14 @@ func Test_SourceInfo(t *testing.T) {
"acquired package info from the following paths",
},
},
{
input: pkg.Package{
Type: pkg.BitnamiPkg,
},
expected: []string{
"acquired package info from a Bitnami SBOM",
},
},
{
input: pkg.Package{
Type: pkg.HexPkg,