Skip to content

fix(license): don't normalize unlicensed licenses into unlicense#9611

Merged
knqyf263 merged 1 commit into
aquasecurity:mainfrom
DmitriyLewen:fix/unlicensed-npm-licenses
Oct 9, 2025
Merged

fix(license): don't normalize unlicensed licenses into unlicense#9611
knqyf263 merged 1 commit into
aquasecurity:mainfrom
DmitriyLewen:fix/unlicensed-npm-licenses

Conversation

@DmitriyLewen
Copy link
Copy Markdown
Contributor

@DmitriyLewen DmitriyLewen commented Oct 8, 2025

Description

This PR fixes a bug in license normalization where "unlicensed" licenses were incorrectly being mapped to "Unlicense".

The issue was that both "UNLICENSE" and "UNLICENSED" were being normalized to the same "Unlicense" license expression. However, these represent fundamentally different licensing concepts:

  • "Unlicense" (or "The Unlicense") is a public domain dedication license that grants maximum freedom
  • "unlicensed" in npm specifically means the package is private/unpublished and the developer grants no rights to use it

The fix removes the mapping of "UNLICENSED" → "Unlicense" from the normalization table, allowing "unlicensed" licenses to be properly categorized as unknown/restricted rather than being incorrectly treated as permissive public domain
licenses.

Example

Before:

➜ trivy -q rootfs --scanners license /Users/dmitriy/work/tmp/9500/package.json --table-mode detailed

Node.js (license)

Total: 1 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 0, CRITICAL: 0)

┌───────────────────────────┬───────────┬────────────────┬──────────┐
│          Package          │  License  │ Classification │ Severity │
├───────────────────────────┼───────────┼────────────────┼──────────┤
│ @nxtvid/component-library │ Unlicense │ Unencumbered   │ LOW      │
└───────────────────────────┴───────────┴────────────────┴──────────┘

After:

➜  ./trivy -q rootfs --scanners license /Users/dmitriy/work/tmp/9500/package.json --table-mode detailed

Node.js (license)

Total: 1 (UNKNOWN: 1, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)

┌───────────────────────────┬────────────┬────────────────┬──────────┐
│          Package          │  License   │ Classification │ Severity │
├───────────────────────────┼────────────┼────────────────┼──────────┤
│ @nxtvid/component-library │ UNLICENSED │ Non Standard   │ UNKNOWN  │
└───────────────────────────┴────────────┴────────────────┴──────────┘

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen added this to the v0.68.0 milestone Oct 8, 2025
@DmitriyLewen DmitriyLewen self-assigned this Oct 8, 2025
@DmitriyLewen DmitriyLewen added the autoready Automatically mark PR as ready for review when all checks pass label Oct 8, 2025
@github-actions github-actions Bot marked this pull request as ready for review October 8, 2025 10:35
@github-actions github-actions Bot removed the autoready Automatically mark PR as ready for review when all checks pass label Oct 8, 2025
@github-actions github-actions Bot requested a review from knqyf263 as a code owner October 8, 2025 10:35
Copy link
Copy Markdown
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is UNLICENSED only used in npm? Is it possible that in other ecosystems, UNLICENSED means unlicense?

@DmitriyLewen
Copy link
Copy Markdown
Contributor Author

DmitriyLewen commented Oct 8, 2025

I found only one ecosystem that uses the UNLICENSED license:
NuGet applies the same logic — https://github.com/nuget/home/wiki/packaging-license-within-the-nupkg-%28technical-spec%29?utm_source=chatgpt.com#approach-for-in-house-packages—unlicensed

Other ecosystems use similar approaches:

For other cases:

  • you should use an SPDX ID or expression
  • or you should provide a license file.

I haven’t found any examples where UNLICENSED is meant to be the same as UNLICENSE.

@knqyf263 knqyf263 added this pull request to the merge queue Oct 9, 2025
Merged via the queue into aquasecurity:main with commit 09162e5 Oct 9, 2025
16 checks passed
@aqua-bot aqua-bot mentioned this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trivy incorrectly reports "UNLICENSED" software as "Unencumbered"

2 participants