Skip to content

Commit

Permalink
make license allowlist matching case insensitive (google#672)
Browse files Browse the repository at this point in the history
this just makes it easier for our users to use.
  • Loading branch information
josieang committed Nov 23, 2023
1 parent 521f59c commit 54d61f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/osvscanner/vulnerability_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package osvscanner
import (
"fmt"
"sort"
"strings"

"github.com/google/osv-scanner/internal/sourceanalysis"
"github.com/google/osv-scanner/pkg/grouper"
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 54d61f3

Please sign in to comment.