[BUG] invalid CycloneDX generated for package with git reference

未关闭
#10,367 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@mvanhorn 已经在做这个了。

开始于 2026年11月28日。

  • #10378 来自 @mvanhorn —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
领域
devtools

调研方向

Start with the CycloneDX SBOM generation path and its tests; the issue does not name specific files, so trace the npm sbom --sbom-format=cyclonedx entry point. Reproduce with a dependency whose repository URL uses the [email protected]: form and inspect the generated externalReferences. Done means the generated SBOM passes CycloneDX validation and handles the invalid URL as described.

由索引模型根据 Issue 内容生成。

描述

Bug Needs Triage
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
This is not just a request to bump a dependency for a CVE
  • This is not solely a request to bump a dependency for a CVE
Current Behavior

using NODE_ENV=production npm sbom --sbom-format=cyclonedx I am generating a SBOM for my package.json:

{
  "name": "my-project",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "glob": "^14.0.6"
  }
}

per schema validator the generated sbom has a invalid schema

sbom.json

validation error:

Validation failed. One invalid URL remains in sbom.json:79 for [email protected]:
[email protected]:isaacs/node-glob.git
Replace it with https://github.com/isaacs/node-glob.git.
Expected Behavior

the generated sbom should be valid according to the CycloneDX schema.
I think npm should not take the invalid url into the final result and instead e.g. emit a warning and skip the invalid data.

Steps To Reproduce
  1. create a package.json with the aboves content
  2. run NODE_ENV=production npm sbom --sbom-format=cyclonedx > sbom.json

-> the generated sbom should not contain [email protected]:isaacs/node-glob.git as a externalReferences because its not a valid http url

Environment
  • npm: 12.2.3
  • Node.js: v26.13.1
  • OS Name: macOS Golden Gate 27.2.1 (26B131)
  • System Model Name: Apple M4 Pro
主要语言
JavaScript
星标
10.3k
派生
5k
平均合并
4 天 11 小时
30 天内合并 PR
26

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

npm/cli 的其他 Issue

查看 npm/cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。