Skip to content

fix: handle legacy licenses array in sbom output - #9010

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

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

Conversation

@JNC4

@JNC4JNC4 commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

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 ownerFebruary 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.
Closesnpm#8892
@JNC4
JNC4force-pushed the fix/sbom-legacy-licenses branch from 35e5817 to e7ad380CompareFebruary 22, 2026 14:35
@wraithgar
wraithgar merged commit 658b323 into npm:latestFeb 24, 2026
20 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Feb 24, 2026
Sign up for freeto 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

@JNC4@wraithgar