Include default config licenses (#3900)

* fix: the licenses config was not being carried through causing content to show by default
---------
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
Christopher Angelo Phillips 2025-05-15 12:48:18 -04:00 committed by GitHub
parent b369b02f4f
commit 4f73d35051
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -255,6 +255,7 @@ func (c *CreateSBOMConfig) selectTasks(src source.Description) ([]task.Task, []t
RelationshipsConfig: c.Relationships, RelationshipsConfig: c.Relationships,
DataGenerationConfig: c.DataGeneration, DataGenerationConfig: c.DataGeneration,
PackagesConfig: c.Packages, PackagesConfig: c.Packages,
LicenseConfig: c.Licenses,
ComplianceConfig: c.Compliance, ComplianceConfig: c.Compliance,
FilesConfig: c.Files, FilesConfig: c.Files,
} }

View File

@ -3,7 +3,7 @@ package cli
import "testing" import "testing"
func Test_Licenses(t *testing.T) { func Test_Licenses(t *testing.T) {
testImage := getFixtureImage(t, "image-unknown-licenses") testImage := getFixtureImage(t, "image-pkg-coverage")
tests := []struct { tests := []struct {
name string name string
args []string args []string

View File

@ -169,7 +169,7 @@ func assertUnknownLicenseContent(required bool) traitAssertion {
for _, pkg := range data.Artifacts { for _, pkg := range data.Artifacts {
for _, lic := range pkg.Licenses { for _, lic := range pkg.Licenses {
if strings.Contains(lic.SPDXExpression, "UNKNOWN") && required { if strings.Contains(lic.Value, "sha256") && required {
assert.NotZero(tb, len(lic.Contents)) assert.NotZero(tb, len(lic.Contents))
} else { } else {
assert.Empty(tb, lic.Contents) assert.Empty(tb, lic.Contents)