From c89d60c8bf993ace090d7d83b96dbe6fb7219c5a Mon Sep 17 00:00:00 2001 From: Raziel Cohen Date: Wed, 3 May 2023 14:18:36 +0300 Subject: [PATCH] issue discovered by redis:alpine image Signed-off-by: Raziel Cohen --- pkg/sbom/v1/sbom_spdx_storage_format.go | 3 ++- pkg/sbom/v1/sbom_spdx_storage_format_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/sbom/v1/sbom_spdx_storage_format.go b/pkg/sbom/v1/sbom_spdx_storage_format.go index f2985838..e99bcf93 100644 --- a/pkg/sbom/v1/sbom_spdx_storage_format.go +++ b/pkg/sbom/v1/sbom_spdx_storage_format.go @@ -41,6 +41,7 @@ const ( sourceInfoRebar = "acquired package info from rebar3 or mix manifest file" sourceInfoLinuxKernel = "acquired package info from linux kernel archive" sourceInfoLinuxKernelModule = "acquired package info from linux kernel module files" + sourceInfoDefault = "acquired package info from the following paths" ) var spdxDataDirPath string @@ -75,7 +76,7 @@ func createSBOMDir() { func init() { createSBOMDir() - sourceInfoPrefixData := []string{sourceInfoDotnet, sourceInfoNodeModule, sourceInfoPythonPackage, sourceInfoJava, sourceInfoGemFile, sourceInfoGoModule, sourceInfoRustCargo, sourceInfoPHPComposer, sourceInfoCabal, sourceInfoRebar, sourceInfoLinuxKernel, sourceInfoLinuxKernelModule} + sourceInfoPrefixData := []string{sourceInfoDotnet, sourceInfoNodeModule, sourceInfoPythonPackage, sourceInfoJava, sourceInfoGemFile, sourceInfoGoModule, sourceInfoRustCargo, sourceInfoPHPComposer, sourceInfoCabal, sourceInfoRebar, sourceInfoLinuxKernel, sourceInfoLinuxKernelModule, sourceInfoDefault} sourceInfoRequiredPrefix = append(sourceInfoRequiredPrefix,sourceInfoPrefixData...) } diff --git a/pkg/sbom/v1/sbom_spdx_storage_format_test.go b/pkg/sbom/v1/sbom_spdx_storage_format_test.go index 477400be..b4ab2576 100644 --- a/pkg/sbom/v1/sbom_spdx_storage_format_test.go +++ b/pkg/sbom/v1/sbom_spdx_storage_format_test.go @@ -483,7 +483,7 @@ func TestParsedFilesBySourceInfo(t *testing.T) { } func TestParsedFilesBySourceInfoFiltered(t *testing.T) { - shouldBeSourcesInfo := []string{"acquired package info from dotnet project assets file: 123, 456", "acquired package info from installed node module manifest file: 123, 456", "acquired package info from installed python package manifest file: 123, 456", "acquired package info from installed java archive: 123, 456", "acquired package info from installed gem metadata file: 123, 456", "acquired package info from go module information: 123, 456", "acquired package info from rust cargo manifest: 123, 456", "acquired package info from PHP composer manifest: 123, 456", "acquired package info from cabal or stack manifest files: 123, 456", "acquired package info from rebar3 or mix manifest files: 123, 456", "acquired package info from linux kernel archive: 123, 456", "acquired package info from linux kernel module files: 123, 456"} + shouldBeSourcesInfo := []string{"acquired package info from dotnet project assets file: 123, 456", "acquired package info from installed node module manifest file: 123, 456", "acquired package info from installed python package manifest file: 123, 456", "acquired package info from installed java archive: 123, 456", "acquired package info from installed gem metadata file: 123, 456", "acquired package info from go module information: 123, 456", "acquired package info from rust cargo manifest: 123, 456", "acquired package info from PHP composer manifest: 123, 456", "acquired package info from cabal or stack manifest files: 123, 456", "acquired package info from rebar3 or mix manifest files: 123, 456", "acquired package info from linux kernel archive: 123, 456", "acquired package info from linux kernel module files: 123, 456", "acquired package info from the following paths: 123, 456"} for i := range shouldBeSourcesInfo { list := parsedFilesBySourceInfo(shouldBeSourcesInfo[i]) if len(list) != 2 {