Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SPDX license operators #8270

Open
knqyf263 opened this issue Jan 21, 2025 · 0 comments
Open

Support SPDX license operators #8270

knqyf263 opened this issue Jan 21, 2025 · 0 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/license Issues relating to license scanning

Comments

@knqyf263
Copy link
Collaborator

Description

Currently, when Trivy's license scanner encounters SPDX license expressions with operators (e.g., "Apache-2.0 OR MIT"), it marks them as non-standard with unknown severity. This behavior doesn't accurately reflect the actual licensing status of packages, especially in ecosystems where dual licensing is common (e.g., Rust ecosystem often uses Apache-2.0/MIT dual licensing).

Proposed Solution

Implement a more sophisticated license expression parser that handles SPDX operators according to their semantic meaning:

  • For "OR" operator:
    • Take the minimum severity among all licenses connected by OR
    • Example: If Package X is licensed under "Apache-2.0 OR MIT"
    • Result: Use the lower severity between Apache-2.0 and MIT
  • For "AND" operator:
    • Take the maximum severity among all licenses connected by AND
    • Example: If Package Y is licensed under "GPL-3.0 AND LGPL-2.1"
    • Result: Use the higher severity between GPL-3.0 and LGPL-2.1

Discussed in #8148

@knqyf263 knqyf263 added kind/feature Categorizes issue or PR as related to a new feature. scan/license Issues relating to license scanning labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/license Issues relating to license scanning
Projects
None yet
Development

No branches or pull requests

1 participant