Skip to content

fix: include shared production dependencies in sbom output - #9936

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

fix: include shared production dependencies in sbom output#9936
rootsec1 wants to merge 1 commit into
npm:latestfrom
rootsec1:fix/sbom-multi-type-omit

Conversation

@rootsec1

Copy link
Copy Markdown

npm sbom --omit=dev can omit an installed package that is used by both a production dependency and a root dev dependency. The dependency-type selector removes the package because of the dev reference even though it is still required by the production tree.

Use Arborist's existing Node.shouldOmit() logic after selecting the nodes instead. This keeps packages that have a non-omitted dependency path while continuing to exclude packages used only by omitted dependency types. Workspace filtering and SBOM formatting remain unchanged.

The regression test covers a hoisted package shared by a production dependency and a root dev dependency. node . test and the lint checks pass.

Closes #7909

@rootsec1
rootsec1 requested review from a team as code owners 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