You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(license): license listed in a category in trivy.yaml keeps its built-in category #11736
When trivy.yaml lists a license in a category, Trivy adds the license to that category but keeps it in its built-in category too. Trivy then picks one of the two categories at random for each package. The same scan shows a different classification and severity from run to run.
LicenseFlagGroup.ToOptions in pkg/flag/license_flags.go puts all six categories in one map, and categories that are not set in the config keep their built-in lists. licenseToCategory and ScanTextLicense in pkg/licensing/scanner.go iterate over this map and return the first match. Go iterates over a map in random order.
MIT is in the built-in notice list. All five packages should be forbidden on every run.
Expected behavior
A license listed in a category in the config belongs only to that category. This must work in both directions. For example, license.permissive: [GPL-3.0] must make GPL-3.0 permissive.
Proposed fix
See #11276 (comment). Compare names case-insensitively, as the scanner does. If the config lists the same license in more than one category, the result is still random, so this case needs a rule too.
I’m working on the config-parsing fix discussed in #11276. I’ll include tests for moving a license in both directions and propose reporting a configuration error if two explicitly configured categories claim the same license.
Activity
Vchekryzhov commentedon Nov 25, 2026
I’m working on the config-parsing fix discussed in #11276. I’ll include tests for moving a license in both directions and propose reporting a configuration error if two explicitly configured categories claim the same license.