diff --git a/apps/cnquery/cmd/sbom.go b/apps/cnquery/cmd/sbom.go index 7b270a71f6..7e21a9b820 100644 --- a/apps/cnquery/cmd/sbom.go +++ b/apps/cnquery/cmd/sbom.go @@ -17,7 +17,6 @@ import ( "go.mondoo.com/cnquery/v10/providers" "go.mondoo.com/cnquery/v10/providers-sdk/v1/plugin" sbom "go.mondoo.com/cnquery/v10/sbom" - "go.mondoo.com/cnquery/v10/shared" ) func init() { @@ -87,14 +86,14 @@ var sbomCmdRun = func(cmd *cobra.Command, runtime *providers.Runtime, cliRes *pl log.Fatal().Err(err).Msg("failed to run scan") } - buf := bytes.Buffer{} - w := shared.IOWriter{Writer: &buf} - err = reporter.ConvertToJSON(report, &w) + cnspecReport, err := reporter.ConvertToProto(report) if err == nil { - logger.DebugDumpJSON("mondoo-sbom-report", buf.Bytes()) + log.Debug().Msg("converted report to proto") + data, _ := cnspecReport.ToJSON() + logger.DebugDumpJSON("mondoo-sbom-report", data) } - boms, err := sbom.NewBom(buf.Bytes()) + boms, err := sbom.NewBom(cnspecReport) if err != nil { log.Fatal().Err(err).Msg("failed to parse bom") } diff --git a/sbom/cnquery_bom_test.go b/sbom/cnquery_bom_test.go index 79ced70da9..c50cf358bb 100644 --- a/sbom/cnquery_bom_test.go +++ b/sbom/cnquery_bom_test.go @@ -12,9 +12,7 @@ import ( ) func TestSimpleBom(t *testing.T) { - r, err := NewReportCollectionJsonFromSingleFile("./testdata/alpine.json") - require.NoError(t, err) - + r := loadTestReport(t) sboms, err := GenerateBom(r) require.NoError(t, err) diff --git a/sbom/cyclonedx_test.go b/sbom/cyclonedx_test.go index 384789643b..9346eca27d 100644 --- a/sbom/cyclonedx_test.go +++ b/sbom/cyclonedx_test.go @@ -12,9 +12,7 @@ import ( ) func TestCycloneDX(t *testing.T) { - r, err := NewReportCollectionJsonFromSingleFile("./testdata/alpine.json") - require.NoError(t, err) - + r := loadTestReport(t) sboms, err := GenerateBom(r) require.NoError(t, err) diff --git a/sbom/report_collection.go b/sbom/report_collection.go index 08632ba65e..ab2e7b5fe6 100644 --- a/sbom/report_collection.go +++ b/sbom/report_collection.go @@ -5,28 +5,8 @@ package sbom import ( "encoding/json" - "errors" - "os" - "sigs.k8s.io/yaml" ) -type ReportCollectionJsonAsset struct { - Mrn string `json:"mrn"` - Name string `json:"name"` - PlatformName string `json:"platform_name"` -} - -type ReportCollectionJsonScore struct { - Score int `json:"score"` - Status string `json:"status"` -} - -type ReportCollectionJson struct { - Assets map[string]ReportCollectionJsonAsset `json:"assets"` - Data map[string]map[string]json.RawMessage `json:"data"` - Scores map[string]map[string]ReportCollectionJsonScore `json:"scores"` -} - // Structures to parse the data from cnquery report type BomAsset struct { Name string `json:"name,omitempty"` @@ -59,7 +39,7 @@ type KernelInstalled struct { Version string } -type BomReport struct { +type BomFields struct { Asset *BomAsset `json:"asset,omitempty"` Packages []BomPackage `json:"packages.list,omitempty"` PythonPackages []BomPackage `json:"python.packages,omitempty"` @@ -67,45 +47,6 @@ type BomReport struct { KernelInstalled []KernelInstalled `json:"kernel.installed,omitempty"` } -func (b *BomReport) ToJSON() ([]byte, error) { +func (b *BomFields) ToJSON() ([]byte, error) { return json.Marshal(b) } - -// AssetMrn returns the MRN of the asset if there is only one -func (r ReportCollectionJson) AssetMrn() (string, error) { - if len(r.Assets) > 1 { - return "", errors.New("report contains more than one asset") - } - - if len(r.Assets) == 0 { - return "", errors.New("report contains no assets") - } - - for _, asset := range r.Assets { - return asset.Mrn, nil - } - - // should not happen - return "", errors.New("report contains no assets") -} - -// NewReportCollectionJsonFromSingleFile loads a cnspec report bundle from a single file -func NewReportCollectionJsonFromSingleFile(path string) (*ReportCollectionJson, error) { - reportData, err := os.ReadFile(path) - if err != nil { - return nil, err - } - - return NewReportCollectionJson(reportData) -} - -// NewReportCollectionJson creates a cnspec report from json contents -func NewReportCollectionJson(data []byte) (*ReportCollectionJson, error) { - var res ReportCollectionJson - err := yaml.Unmarshal(data, &res) - return &res, err -} - -func (p *ReportCollectionJson) ToYAML() ([]byte, error) { - return yaml.Marshal(p) -} diff --git a/sbom/sbom.go b/sbom/sbom.go index 02cba2ef7b..5d6619b290 100644 --- a/sbom/sbom.go +++ b/sbom/sbom.go @@ -9,6 +9,7 @@ import ( _ "embed" "encoding/json" "fmt" + "go.mondoo.com/cnquery/v10/cli/reporter" "strings" "time" @@ -30,16 +31,12 @@ func QueryPack() (*explorer.Bundle, error) { } // NewBom creates a BOM from a json report collection -func NewBom(data []byte) ([]Sbom, error) { - jr, err := NewReportCollectionJson(data) - if err != nil { - return nil, err - } - return GenerateBom(jr) +func NewBom(report *reporter.Report) ([]Sbom, error) { + return GenerateBom(report) } // GenerateBom generates a BOM from a cnspec json report collection -func GenerateBom(r *ReportCollectionJson) ([]Sbom, error) { +func GenerateBom(r *reporter.Report) ([]Sbom, error) { if r == nil { return nil, nil } @@ -74,9 +71,14 @@ func GenerateBom(r *ReportCollectionJson) ([]Sbom, error) { // extract os packages and python packages dataPoints := r.Data[mrn] - for k := range dataPoints { - rb := BomReport{} - err := json.Unmarshal(dataPoints[k], &rb) + for k := range dataPoints.Values { + dataValue := dataPoints.Values[k] + jsondata, err := reporter.JsonValue(dataValue.Content) + if err != nil { + return nil, err + } + rb := BomFields{} + err = json.Unmarshal(jsondata, &rb) if err != nil { return nil, err } diff --git a/sbom/sbom.pb.go b/sbom/sbom.pb.go index 47deca77c1..6ff07105b4 100644 --- a/sbom/sbom.pb.go +++ b/sbom/sbom.pb.go @@ -3,7 +3,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.33.0 // protoc v4.25.3 // source: sbom.proto @@ -993,9 +993,9 @@ var file_sbom_proto_rawDesc = []byte{ 0x56, 0x49, 0x44, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x56, 0x49, 0x44, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, - 0x10, 0x01, 0x42, 0x1c, 0x5a, 0x1a, 0x67, 0x6f, 0x2e, 0x6d, 0x6f, 0x6e, 0x64, 0x6f, 0x6f, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x62, 0x6f, 0x6d, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x01, 0x42, 0x20, 0x5a, 0x1e, 0x67, 0x6f, 0x2e, 0x6d, 0x6f, 0x6e, 0x64, 0x6f, 0x6f, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x30, 0x2f, + 0x73, 0x62, 0x6f, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/sbom/sbom_test.go b/sbom/sbom_test.go index d3840a2c8b..c0d5c29a35 100644 --- a/sbom/sbom_test.go +++ b/sbom/sbom_test.go @@ -6,13 +6,23 @@ package sbom import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.mondoo.com/cnquery/v10/cli/reporter" + "os" + "sigs.k8s.io/yaml" "testing" ) -func TestSbomParsing(t *testing.T) { - r, err := NewReportCollectionJsonFromSingleFile("./testdata/alpine.json") +func loadTestReport(t *testing.T) *reporter.Report { + data, err := os.ReadFile("./testdata/alpine.json") + require.NoError(t, err) + var report *reporter.Report + err = yaml.Unmarshal(data, &report) require.NoError(t, err) + return report +} +func TestSbomParsing(t *testing.T) { + r := loadTestReport(t) sboms, err := GenerateBom(r) require.NoError(t, err) diff --git a/sbom/spdx_test.go b/sbom/spdx_test.go index 1dbbe28dd4..dfed6d0210 100644 --- a/sbom/spdx_test.go +++ b/sbom/spdx_test.go @@ -11,9 +11,7 @@ import ( ) func TestSpdx(t *testing.T) { - r, err := NewReportCollectionJsonFromSingleFile("./testdata/alpine.json") - require.NoError(t, err) - + r := loadTestReport(t) sboms, err := GenerateBom(r) require.NoError(t, err) diff --git a/sbom/testdata/alpine.json b/sbom/testdata/alpine.json index cb60b50a9e..0ce2183d9f 100644 --- a/sbom/testdata/alpine.json +++ b/sbom/testdata/alpine.json @@ -7,329 +7,339 @@ }, "data": { "//explorer.api.mondoo.com/assets/2cNOBxIv7117UjcqsDBvKUgwkKw": { - "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-asset": { - "asset": { - "version": "3.19.0", - "arch": "aarch64", - "labels": { - "distro-id": "alpine" - }, - "platform": "alpine", - "ids": [ - "//platformid.api.mondoo.app/runtime/docker/images/1dc785547989b0db1c3cd9949c57574393e69bea98bfe044b0588e24721aa402" - ], - "name": "alpine:latest", - "cpes.map": [ - "cpe:2.3:o:alpinelinux:alpine_linux:3.19.0:*:*:*:*:*:*:*" - ] - } - }, - "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-packages": { - "packages.list": [ - { - "purl": "pkg:apk/alpine/alpine-baselayout@1695795276%3A3.4.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1695795276", - "version": "1695795276:3.4.3-r2", - "name": "alpine-baselayout", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:alpine-baselayout:alpine-baselayout:1695795276:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "etc/motd", - "etc/crontabs/root", - "etc/modprobe.d/aliases.conf", - "etc/modprobe.d/blacklist.conf", - "etc/modprobe.d/i386.conf", - "etc/modprobe.d/kms.conf", - "etc/profile.d/20locale.sh", - "etc/profile.d/README", - "etc/profile.d/color_prompt.sh.disabled", - "lib/sysctl.d/00-alpine.conf", - "var/run", - "var/spool/mail", - "var/spool/cron/crontabs" - ] - }, - { - "purl": "pkg:apk/alpine/alpine-baselayout-data@1695795276%3A3.4.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1695795276", - "version": "1695795276:3.4.3-r2", - "name": "alpine-baselayout-data", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:alpine-baselayout-data:alpine-baselayout-data:1695795276:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "etc/fstab", - "etc/group", - "etc/hostname", - "etc/hosts", - "etc/inittab", - "etc/modules", - "etc/mtab", - "etc/nsswitch.conf", - "etc/passwd", - "etc/profile", - "etc/protocols", - "etc/services", - "etc/shadow", - "etc/shells", - "etc/sysctl.conf" - ] - }, - { - "purl": "pkg:apk/alpine/alpine-keys@1634579657%3A2.4-r1?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1634579657", - "version": "1634579657:2.4-r1", - "name": "alpine-keys", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:alpine-keys:alpine-keys:1634579657:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "etc/apk/keys/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", - "etc/apk/keys/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", - "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", - "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", - "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5e69ca50.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-60ac2099.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-61666e3f.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616abc23.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616ac3bc.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", - "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616db30d.rsa.pub", - "usr/share/apk/keys/aarch64/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", - "usr/share/apk/keys/aarch64/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", - "usr/share/apk/keys/armhf/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", - "usr/share/apk/keys/armhf/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", - "usr/share/apk/keys/armv7/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", - "usr/share/apk/keys/armv7/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", - "usr/share/apk/keys/mips64/alpine-devel@lists.alpinelinux.org-5e69ca50.rsa.pub", - "usr/share/apk/keys/ppc64le/alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub", - "usr/share/apk/keys/ppc64le/alpine-devel@lists.alpinelinux.org-616abc23.rsa.pub", - "usr/share/apk/keys/riscv64/alpine-devel@lists.alpinelinux.org-60ac2099.rsa.pub", - "usr/share/apk/keys/riscv64/alpine-devel@lists.alpinelinux.org-616db30d.rsa.pub", - "usr/share/apk/keys/s390x/alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub", - "usr/share/apk/keys/s390x/alpine-devel@lists.alpinelinux.org-616ac3bc.rsa.pub", - "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", - "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub", - "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-61666e3f.rsa.pub", - "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", - "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub", - "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub" - ] - }, - { - "purl": "pkg:apk/alpine/apk-tools@1684120357%3A2.14.0-r5?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1684120357", - "version": "1684120357:2.14.0-r5", - "name": "apk-tools", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:apk-tools:apk-tools:1684120357:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "lib/libapk.so.2.14.0", - "sbin/apk" - ] - }, - { - "purl": "pkg:apk/alpine/busybox@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", - "version": "1699383189:1.36.1-r15", - "name": "busybox", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:busybox:busybox:1699383189:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "bin/busybox", - "etc/securetty", - "etc/udhcpd.conf", - "etc/busybox-paths.d/busybox", - "etc/logrotate.d/acpid", - "etc/network/if-up.d/dad", - "etc/udhcpc/udhcpc.conf", - "usr/share/udhcpc/default.script" - ] - }, - { - "purl": "pkg:apk/alpine/busybox-binsh@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", - "version": "1699383189:1.36.1-r15", - "name": "busybox-binsh", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:busybox-binsh:busybox-binsh:1699383189:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "bin/sh" - ] - }, - { - "purl": "pkg:apk/alpine/ca-certificates-bundle@1683374901%3A20230506-r0?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1683374901", - "version": "1683374901:20230506-r0", - "name": "ca-certificates-bundle", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:ca-certificates-bundle:ca-certificates-bundle:1683374901:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "etc/ssl/cert.pem", - "etc/ssl/certs/ca-certificates.crt", - "etc/ssl1.1/cert.pem", - "etc/ssl1.1/certs" - ] - }, - { - "purl": "pkg:apk/alpine/libc-utils@1682166293%3A0.7.2-r5?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1682166293", - "version": "1682166293:0.7.2-r5", - "name": "libc-utils", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:libc-utils:libc-utils:1682166293:aarch64:*:*:*:*:*:*" - ], - "files.map": [] - }, - { - "purl": "pkg:apk/alpine/libcrypto3@1701101689%3A3.1.4-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1701101689", - "version": "1701101689:3.1.4-r2", - "name": "libcrypto3", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:libcrypto3:libcrypto3:1701101689:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "etc/ssl/ct_log_list.cnf", - "etc/ssl/ct_log_list.cnf.dist", - "etc/ssl/openssl.cnf", - "etc/ssl/openssl.cnf.dist", - "etc/ssl/misc/CA.pl", - "etc/ssl/misc/tsget", - "etc/ssl/misc/tsget.pl", - "lib/libcrypto.so.3", - "usr/lib/libcrypto.so.3", - "usr/lib/engines-3/afalg.so", - "usr/lib/engines-3/capi.so", - "usr/lib/engines-3/loader_attic.so", - "usr/lib/engines-3/padlock.so", - "usr/lib/ossl-modules/legacy.so" - ] - }, - { - "purl": "pkg:apk/alpine/libssl3@1701101689%3A3.1.4-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1701101689", - "version": "1701101689:3.1.4-r2", - "name": "libssl3", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:libssl3:libssl3:1701101689:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "lib/libssl.so.3", - "usr/lib/libssl.so.3" - ] - }, - { - "purl": "pkg:apk/alpine/musl@1699271358%3A1.2.4_git20230717-r4?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699271358", - "version": "1699271358:1.2.4_git20230717-r4", - "name": "musl", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:musl:musl:1699271358:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "lib/ld-musl-aarch64.so.1", - "lib/libc.musl-aarch64.so.1" - ] - }, - { - "purl": "pkg:apk/alpine/musl-utils@1699271358%3A1.2.4_git20230717-r4?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699271358", - "version": "1699271358:1.2.4_git20230717-r4", - "name": "musl-utils", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:musl-utils:musl-utils:1699271358:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "sbin/ldconfig", - "usr/bin/getconf", - "usr/bin/getent", - "usr/bin/iconv", - "usr/bin/ldd" - ] - }, - { - "purl": "pkg:apk/alpine/scanelf@1687178519%3A1.3.7-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1687178519", - "version": "1687178519:1.3.7-r2", - "name": "scanelf", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:scanelf:scanelf:1687178519:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "usr/bin/scanelf" - ] - }, - { - "purl": "pkg:apk/alpine/ssl_client@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", - "version": "1699383189:1.36.1-r15", - "name": "ssl_client", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:ssl_client:ssl_client:1699383189:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "usr/bin/ssl_client" - ] - }, - { - "purl": "pkg:apk/alpine/zlib@1698371416%3A1.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1698371416", - "version": "1698371416:1.3-r2", - "name": "zlib", - "format": "apk", - "cpes.map": [ - "cpe:2.3:a:zlib:zlib:1698371416:aarch64:*:*:*:*:*:*" - ], - "files.map": [ - "lib/libz.so.1", - "lib/libz.so.1.3" + "values": { + "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-asset": { + "content": { + "asset": { + "version": "3.19.0", + "arch": "aarch64", + "labels": { + "distro-id": "alpine" + }, + "platform": "alpine", + "ids": [ + "//platformid.api.mondoo.app/runtime/docker/images/1dc785547989b0db1c3cd9949c57574393e69bea98bfe044b0588e24721aa402" + ], + "name": "alpine:latest", + "cpes.map": [ + "cpe:2.3:o:alpinelinux:alpine_linux:3.19.0:*:*:*:*:*:*:*" + ] + } + } + }, + "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-packages": { + "content": { + "packages.list": [ + { + "purl": "pkg:apk/alpine/alpine-baselayout@1695795276%3A3.4.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1695795276", + "version": "1695795276:3.4.3-r2", + "name": "alpine-baselayout", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:alpine-baselayout:alpine-baselayout:1695795276:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "etc/motd", + "etc/crontabs/root", + "etc/modprobe.d/aliases.conf", + "etc/modprobe.d/blacklist.conf", + "etc/modprobe.d/i386.conf", + "etc/modprobe.d/kms.conf", + "etc/profile.d/20locale.sh", + "etc/profile.d/README", + "etc/profile.d/color_prompt.sh.disabled", + "lib/sysctl.d/00-alpine.conf", + "var/run", + "var/spool/mail", + "var/spool/cron/crontabs" + ] + }, + { + "purl": "pkg:apk/alpine/alpine-baselayout-data@1695795276%3A3.4.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1695795276", + "version": "1695795276:3.4.3-r2", + "name": "alpine-baselayout-data", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:alpine-baselayout-data:alpine-baselayout-data:1695795276:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "etc/fstab", + "etc/group", + "etc/hostname", + "etc/hosts", + "etc/inittab", + "etc/modules", + "etc/mtab", + "etc/nsswitch.conf", + "etc/passwd", + "etc/profile", + "etc/protocols", + "etc/services", + "etc/shadow", + "etc/shells", + "etc/sysctl.conf" + ] + }, + { + "purl": "pkg:apk/alpine/alpine-keys@1634579657%3A2.4-r1?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1634579657", + "version": "1634579657:2.4-r1", + "name": "alpine-keys", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:alpine-keys:alpine-keys:1634579657:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "etc/apk/keys/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", + "etc/apk/keys/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", + "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", + "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", + "etc/apk/keys/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-5e69ca50.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-60ac2099.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-61666e3f.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616abc23.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616ac3bc.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", + "usr/share/apk/keys/alpine-devel@lists.alpinelinux.org-616db30d.rsa.pub", + "usr/share/apk/keys/aarch64/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub", + "usr/share/apk/keys/aarch64/alpine-devel@lists.alpinelinux.org-616ae350.rsa.pub", + "usr/share/apk/keys/armhf/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", + "usr/share/apk/keys/armhf/alpine-devel@lists.alpinelinux.org-616a9724.rsa.pub", + "usr/share/apk/keys/armv7/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub", + "usr/share/apk/keys/armv7/alpine-devel@lists.alpinelinux.org-616adfeb.rsa.pub", + "usr/share/apk/keys/mips64/alpine-devel@lists.alpinelinux.org-5e69ca50.rsa.pub", + "usr/share/apk/keys/ppc64le/alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub", + "usr/share/apk/keys/ppc64le/alpine-devel@lists.alpinelinux.org-616abc23.rsa.pub", + "usr/share/apk/keys/riscv64/alpine-devel@lists.alpinelinux.org-60ac2099.rsa.pub", + "usr/share/apk/keys/riscv64/alpine-devel@lists.alpinelinux.org-616db30d.rsa.pub", + "usr/share/apk/keys/s390x/alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub", + "usr/share/apk/keys/s390x/alpine-devel@lists.alpinelinux.org-616ac3bc.rsa.pub", + "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", + "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub", + "usr/share/apk/keys/x86/alpine-devel@lists.alpinelinux.org-61666e3f.rsa.pub", + "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub", + "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub", + "usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub" + ] + }, + { + "purl": "pkg:apk/alpine/apk-tools@1684120357%3A2.14.0-r5?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1684120357", + "version": "1684120357:2.14.0-r5", + "name": "apk-tools", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:apk-tools:apk-tools:1684120357:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "lib/libapk.so.2.14.0", + "sbin/apk" + ] + }, + { + "purl": "pkg:apk/alpine/busybox@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", + "version": "1699383189:1.36.1-r15", + "name": "busybox", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:busybox:busybox:1699383189:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "bin/busybox", + "etc/securetty", + "etc/udhcpd.conf", + "etc/busybox-paths.d/busybox", + "etc/logrotate.d/acpid", + "etc/network/if-up.d/dad", + "etc/udhcpc/udhcpc.conf", + "usr/share/udhcpc/default.script" + ] + }, + { + "purl": "pkg:apk/alpine/busybox-binsh@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", + "version": "1699383189:1.36.1-r15", + "name": "busybox-binsh", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:busybox-binsh:busybox-binsh:1699383189:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "bin/sh" + ] + }, + { + "purl": "pkg:apk/alpine/ca-certificates-bundle@1683374901%3A20230506-r0?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1683374901", + "version": "1683374901:20230506-r0", + "name": "ca-certificates-bundle", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:ca-certificates-bundle:ca-certificates-bundle:1683374901:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "etc/ssl/cert.pem", + "etc/ssl/certs/ca-certificates.crt", + "etc/ssl1.1/cert.pem", + "etc/ssl1.1/certs" + ] + }, + { + "purl": "pkg:apk/alpine/libc-utils@1682166293%3A0.7.2-r5?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1682166293", + "version": "1682166293:0.7.2-r5", + "name": "libc-utils", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:libc-utils:libc-utils:1682166293:aarch64:*:*:*:*:*:*" + ], + "files.map": [] + }, + { + "purl": "pkg:apk/alpine/libcrypto3@1701101689%3A3.1.4-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1701101689", + "version": "1701101689:3.1.4-r2", + "name": "libcrypto3", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:libcrypto3:libcrypto3:1701101689:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "etc/ssl/ct_log_list.cnf", + "etc/ssl/ct_log_list.cnf.dist", + "etc/ssl/openssl.cnf", + "etc/ssl/openssl.cnf.dist", + "etc/ssl/misc/CA.pl", + "etc/ssl/misc/tsget", + "etc/ssl/misc/tsget.pl", + "lib/libcrypto.so.3", + "usr/lib/libcrypto.so.3", + "usr/lib/engines-3/afalg.so", + "usr/lib/engines-3/capi.so", + "usr/lib/engines-3/loader_attic.so", + "usr/lib/engines-3/padlock.so", + "usr/lib/ossl-modules/legacy.so" + ] + }, + { + "purl": "pkg:apk/alpine/libssl3@1701101689%3A3.1.4-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1701101689", + "version": "1701101689:3.1.4-r2", + "name": "libssl3", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:libssl3:libssl3:1701101689:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "lib/libssl.so.3", + "usr/lib/libssl.so.3" + ] + }, + { + "purl": "pkg:apk/alpine/musl@1699271358%3A1.2.4_git20230717-r4?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699271358", + "version": "1699271358:1.2.4_git20230717-r4", + "name": "musl", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:musl:musl:1699271358:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "lib/ld-musl-aarch64.so.1", + "lib/libc.musl-aarch64.so.1" + ] + }, + { + "purl": "pkg:apk/alpine/musl-utils@1699271358%3A1.2.4_git20230717-r4?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699271358", + "version": "1699271358:1.2.4_git20230717-r4", + "name": "musl-utils", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:musl-utils:musl-utils:1699271358:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "sbin/ldconfig", + "usr/bin/getconf", + "usr/bin/getent", + "usr/bin/iconv", + "usr/bin/ldd" + ] + }, + { + "purl": "pkg:apk/alpine/scanelf@1687178519%3A1.3.7-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1687178519", + "version": "1687178519:1.3.7-r2", + "name": "scanelf", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:scanelf:scanelf:1687178519:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "usr/bin/scanelf" + ] + }, + { + "purl": "pkg:apk/alpine/ssl_client@1699383189%3A1.36.1-r15?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1699383189", + "version": "1699383189:1.36.1-r15", + "name": "ssl_client", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:ssl_client:ssl_client:1699383189:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "usr/bin/ssl_client" + ] + }, + { + "purl": "pkg:apk/alpine/zlib@1698371416%3A1.3-r2?arch=aarch64\u0026distro=alpine-3.19.0\u0026epoch=1698371416", + "version": "1698371416:1.3-r2", + "name": "zlib", + "format": "apk", + "cpes.map": [ + "cpe:2.3:a:zlib:zlib:1698371416:aarch64:*:*:*:*:*:*" + ], + "files.map": [ + "lib/libz.so.1", + "lib/libz.so.1.3" + ] + } ] } - ] - }, - "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-python-packages": { - "python.packages": [ - { - "name": "pip", - "version": "21.2.4", - "cpes.map": [ - "cpe:2.3:a:pip_project:pip:21.2.4:*:*:*:*:*:*:*" - ], - "purl": "pkg:pypi/pip@21.2.4", - "file.path": "/opt/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA" + }, + "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-python-packages": { + "content": { + "python.packages": [ + { + "name": "pip", + "version": "21.2.4", + "cpes.map": [ + "cpe:2.3:a:pip_project:pip:21.2.4:*:*:*:*:*:*:*" + ], + "purl": "pkg:pypi/pip@21.2.4", + "file.path": "/opt/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA" + } + ] } - ] - }, - "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-npm-packages": { - "npm.packages.list": [ - { - "name": "npm", - "files.map": [ - "/opt/lib/node_modules/npm/package.json" - ], - "cpes.map": [ - "cpe:2.3:a:npm:npm:10.2.4:*:*:*:*:*:*:*" - ], - "purl": "pkg:npm/npm@10.2.4", - "version": "10.2.4" + }, + "//local.cnquery.io/run/local-execution/queries/mondoo-sbom-npm-packages": { + "content": { + "npm.packages.list": [ + { + "name": "npm", + "files.map": [ + "/opt/lib/node_modules/npm/package.json" + ], + "cpes.map": [ + "cpe:2.3:a:npm:npm:10.2.4:*:*:*:*:*:*:*" + ], + "purl": "pkg:npm/npm@10.2.4", + "version": "10.2.4" + } + ] } - ] + } } } },