detect license ID from full text when incidentally provided as a value (#3876)

---------
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Christopher Angelo Phillips
2025-05-13 16:37:18 -04:00
committed by GitHub
co-authored by Alex Goodman
parent b4d717fb30
commit f77d503892
117 changed files with 2082 additions and 1327 deletions
+13 -2
View File
@@ -20,9 +20,9 @@ func Test_Licenses(t *testing.T) {
assertSuccessfulReturnCode,
},
},
// deprecated LICENSE_INCLUDE_UNKNOWN_LICENSE_CONTENT
{
name: "licenses with content",
name: "licenses with content works without deprecated LICENSE_INCLUDE_UNKNOWN_LICENSE_CONTENT",
args: []string{"scan", "-o", "json", testImage, "--from", "docker-archive"},
env: map[string]string{"SYFT_FORMAT_PRETTY": "true", "SYFT_LICENSE_INCLUDE_UNKNOWN_LICENSE_CONTENT": "true"},
assertions: []traitAssertion{
@@ -31,6 +31,17 @@ func Test_Licenses(t *testing.T) {
assertSuccessfulReturnCode,
},
},
// use new license content configuration
{
name: "licenses with content works with new CONTENT configuration",
args: []string{"scan", "-o", "json", testImage, "--from", "docker-archive"},
env: map[string]string{"SYFT_FORMAT_PRETTY": "true", "SYFT_LICENSE_CONTENT": "unknown"},
assertions: []traitAssertion{
assertJsonReport,
assertUnknownLicenseContent(true),
assertSuccessfulReturnCode,
},
},
}
for _, test := range tests {