[BUG] SBOM packages and relationships missing under some circumstances
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 I try to generate SBOM for the opentelemetry-js repository, the output is missing some packages and relationships.
The repository is a monorepo with many sub-packages. They are defined using npm workspaces and listed under the packages and experimental/packages directories. Ideally, I would like to generate an SBOM file for each sub-package.
When I run the command below to generate SBOM for a single sub-package (packages/opentelemetry-core), it is missing in the relationships section (the dependency is in the packages/opentelemetry-semantic-conventions directory).
npm sbom --sbom-format spdx --omit dev --workspace packages/opentelemetry-core > sbom.json
The relationship is missing even when I generate SBOM for the whole repository by running this in the root directory:
npm sbom --sbom-format spdx --omit dev > sbom.json
In addition, the SBOM output for the whole repository is missing some dependencies completely even in the packages section of the SBOM file. For example, the sub-package in folder packages/opentelemetry-sdk-trace-node has a dependency on semver, but semver is not included in the SBOM file at all.
Expected Behavior
npm sbom should capture all dependencies in a repository with workspaces.
Steps To Reproduce
First issue:
- Generate SBOM file using these steps
git clone git@github.com:open-telemetry/opentelemetry-js.git
cd opentelemetry-js
npm ci
npm sbom --sbom-format spdx --omit dev --workspace packages/opentelemetry-core > sbom.json
- In the generated SBOM file, note that the package
@opentelemetry/semantic-conventionsis listed underpackages, but NOT underdependencies.
Second issue:
- Generate SBOM file using these steps
git clone git@github.com:open-telemetry/opentelemetry-js.git
cd opentelemetry-js
npm ci
npm sbom --sbom-format spdx --omit dev > sbom.json
- In the generates SBOM file, note that the
semverpackage is completely missing (in bothpackagesandrelationshipssections), even though the package inpackages/opentelemetry-sdk-trace-nodedepends on it.
Environment
- npm: 10.4.0
- Node.js: v18.18.0
- OS Name: macOS 14.2.1
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 two SBOM commands in the opentelemetry-js repository after npm ci, using the workspace and root cases described. Compare the generated SPDX packages, dependencies, and relationships, including @opentelemetry/semantic-conventions and semver; done means all workspace dependencies and relationships are captured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100