[BUG] SBOM omit dev too greedy
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When running npm sbom --omit dev, also packages will be omitted that are actually production-dependencies. In my example (see steps to reproduce), @angular/core and its transitive dependencies are not added to the SBOM.
The problem has to to with @angular/compiler having @angular/core as peerDependency and being a dev-dependency. Manually removing the peerDependencies and peerDependenciesMeta from the @angular/compiler-package in the package-lock.json will solve the issue.
Could you please have a look into this.
Expected Behavior
Production-dependencies and their transitive dependencies should be included into the SBOM, if not omitted.
Steps To Reproduce
npm initnpm i @angular/core@18.2.11npm sbom --sbom-format cyclonedx --omit dev --package-lock-only | grep bom-refwill include @angular/corenpm i -D @angular/compiler@18.2.11npm sbom --sbom-format cyclonedx --omit dev --package-lock-only | grep bom-refwill NOT include @angular/core
Environment
- npm: 10.9.0
- Node.js: 22.11.0
- OS Name: debian 12
- System Model Name: PC
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the listed npm commands using package-lock.json, comparing the SBOM before and after adding @angular/compiler as a dev dependency. Trace the npm sbom --omit dev dependency traversal, especially peer dependencies, and verify that @angular/core and its production transitive dependencies remain in the CycloneDX output while dev-only packages are omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, security, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100