Skip to content

fix: preserve production dependencies in omitted SBOMs - #9935

Closed
rootsec1 wants to merge 1 commit into
npm:latestfrom
rootsec1:fix/sbom-multi-type-omit
Closed

fix: preserve production dependencies in omitted SBOMs#9935
rootsec1 wants to merge 1 commit into
npm:latestfrom
rootsec1:fix/sbom-multi-type-omit

Conversation

@rootsec1

Copy link
Copy Markdown

npm sbom currently applies --omit through Arborist query dependency-type selectors. Those selectors also match a package reached through an omitted edge, so --omit=dev drops a production dependency when the same installed package is also referenced as a development dependency.

Filter the selected nodes with Arborist's existing Node.shouldOmit() semantics instead. A package remains in the SBOM when it is reachable through a non-omitted dependency type, while dependencies exclusive to omitted types continue to be excluded. Workspace selection and SBOM formatting are unchanged, which keeps the compatibility risk limited to correcting false-negative components.

The regression test models a hoisted package shared by a production dependency and a root development dependency. It fails without the change and passes with it. node . test and the repository lint checks pass.

Closes #7909

@rootsec1
rootsec1 requested review from a team as code owners August 31, 2026 12:33
@rootsec1 rootsec1 closed this Aug 31, 2026
@rootsec1
rootsec1 deleted the fix/sbom-multi-type-omit branch August 31, 2026 12:35
@rootsec1
rootsec1 restored the fix/sbom-multi-type-omit branch August 31, 2026 17:36
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] SBOM omit dev too greedy

1 participant