From 54d61f3d6772ad0d2500364735d073f385777254 Mon Sep 17 00:00:00 2001 From: josieang <32358891+josieang@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:05:36 +1100 Subject: [PATCH] make license allowlist matching case insensitive (#672) this just makes it easier for our users to use. --- pkg/osvscanner/vulnerability_result.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/osvscanner/vulnerability_result.go b/pkg/osvscanner/vulnerability_result.go index 8eb0b483d7..cbdb104b5e 100644 --- a/pkg/osvscanner/vulnerability_result.go +++ b/pkg/osvscanner/vulnerability_result.go @@ -3,6 +3,7 @@ package osvscanner import ( "fmt" "sort" + "strings" "github.com/google/osv-scanner/internal/sourceanalysis" "github.com/google/osv-scanner/pkg/grouper" @@ -66,10 +67,10 @@ func buildVulnerabilityResults( pkg.Licenses = licensesResp[i] allowlist := make(map[string]bool) for _, license := range licensesAllowlist { - allowlist[license] = true + allowlist[strings.ToLower(license)] = true } for _, license := range pkg.Licenses { - if !allowlist[string(license)] { + if !allowlist[strings.ToLower(string(license))] { pkg.LicenseViolations = append(pkg.LicenseViolations, license) } }