-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Copy link
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.scan/licenseIssues relating to license scanningIssues relating to license scanning
Milestone
Description
Description
apk
packages may use licenses that ccontain the WITH
operator (e.g. GPL-2.0-only WITH Classpath-exception-2.0
).
Instead of creating single license - Trivy creates 3 licenses:
"Licenses": [
"GPL-2.0-only",
"WITH",
"Classpath-exception-2.0"
],
Problem
LaxSplitLicenses
function doesn't handle WITH
operator:
trivy/pkg/licensing/normalize.go
Lines 751 to 769 in a692f29
func LaxSplitLicenses(str string) []string { | |
if str == "" { | |
return nil | |
} | |
var licenses []string | |
str = versionRegexp.ReplaceAllString(str, "$1-$4") | |
for s := range strings.FieldsSeq(str) { | |
s = strings.Trim(s, "()") | |
switch s { | |
case "": | |
continue | |
case "AND", "OR": | |
continue | |
default: | |
licenses = append(licenses, Normalize(s)) | |
} | |
} | |
return licenses | |
} |
Discussed in #9229
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.scan/licenseIssues relating to license scanningIssues relating to license scanning