Skip to content

Comments

fix: handle legacy licenses array in sbom output#9010

Merged
wraithgar merged 1 commit intonpm:latestfrom
JNC4:fix/sbom-legacy-licenses
Feb 24, 2026
Merged

fix: handle legacy licenses array in sbom output#9010
wraithgar merged 1 commit intonpm:latestfrom
JNC4:fix/sbom-legacy-licenses

Conversation

@JNC4
Copy link
Contributor

@JNC4 JNC4 commented Feb 22, 2026

Fixes #8892

Older packages on the registry use the deprecated licenses array ("licenses": [{"type": "MIT", ...}]) instead of the singular license string. npm sbom only checked for license, so these packages all showed up as NOASSERTION.

This checks for the licenses array as a fallback in both the SPDX and CycloneDX codepaths. When there are multiple entries they're joined with OR.

Also noticed the CycloneDX expression branch was referencing node.package.license directly instead of the already-computed variable, which would break for these legacy packages. Fixed that too.

@JNC4 JNC4 requested a review from a team as a code owner February 22, 2026 14:34
Packages using the deprecated `licenses` array property in
package.json (e.g. `"licenses": [{"type": "MIT", "url": "..."}]`)
were reported as NOASSERTION in both SPDX and CycloneDX SBOM output.

This adds support for the legacy format by checking for the `licenses`
array when `license` is not present, joining multiple entries with
" OR " per SPDX conventions.

Closes npm#8892
@JNC4 JNC4 force-pushed the fix/sbom-legacy-licenses branch from 35e5817 to e7ad380 Compare February 22, 2026 14:35
@wraithgar wraithgar merged commit 658b323 into npm:latest Feb 24, 2026
20 checks passed
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.

[BUG] npm sbom does not handle legacy licenses array property in package.json

2 participants