mcpField
S
sbom-analyzer

sbom-analyzer

github.com/snyk安全68136 次安装1 周前更新
代码仓库

关于 sbom-analyzer

sbom-analyzer 是用于分析软件物料清单的安全技能,面向第三方风险管理和合规工作流。它验证 CycloneDX 或 SPDX JSON 文件,再扫描组件漏洞并整理风险与修复建议。

主要功能

  1. 01验证 CycloneDX 和 SPDX 格式
  2. 02检查 SBOM 完整性及 PURL
  3. 03扫描组件漏洞
  4. 04汇总风险发现
  5. 05提供升级建议和供应商沟通模板

适用场景

  1. 01审查供应商提供的 SBOM
  2. 02评估第三方组件风险
  3. 03为内部项目生成并扫描 SBOM

MCP 相关

该技能调用 Snyk MCP 的 SBOM 扫描工具,分析清单组件中的漏洞。扫描需要联网,且组件需包含 PURL。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/snyk/studio-recipes --skill sbom-analyzer

安装后在 Claude Code 中输入/sbom-analyzer确认已加载。

附带文件references/sbom-formats.md

详细介绍

SBOM 安全分析器

分析软件物料清单,识别其中声明的组件是否存在漏洞,用于第三方风险管理和合规工作流。

核心原则:了解软件供应链中包含哪些内容。


快速开始

1. Receive or locate SBOM file (CycloneDX or SPDX)
2. Validate SBOM format and completeness
3. Run mcp_snyk_snyk_sbom_scan for vulnerability analysis
4. Generate risk report with prioritized findings
5. Provide remediation guidance

支持的 SBOM 格式

格式版本文件扩展名
CycloneDX1.4、1.5、1.6.json
SPDX2.3.json

注意:mcp_snyk_snyk_sbom_scan 需要 SBOM 中包含 Package URL(purl),以识别组件。


阶段 1:SBOM 验证

目标:在分析之前确保 SBOM 有效且完整。

步骤 1.1:识别 SBOM 格式

检查文件结构:

CycloneDX 标识:

{
  "bomFormat": "CycloneDX",
  "specVersion": "1.5",
  "components": [...]
}

SPDX 标识:

{
  "spdxVersion": "SPDX-2.3",
  "SPDXID": "SPDXRef-DOCUMENT",
  "packages": [...]
}
步骤 1.2:验证完整性

检查必需元素:

元素CycloneDXSPDX必需
格式版本specVersionspdxVersion是
组件列表componentspackages是
Package URL组件中的 purlexternalRefs是*
许可证licenseslicenseConcluded建议提供
校验和hasheschecksums建议提供

* Snyk 需要 Package URL 才能识别漏洞。

步骤 1.3:报告验证问题

如果 SBOM 不完整,请按以下格式生成报告:

## SBOM Validation Results

**File**: supplier-sbom.json
**Format**: CycloneDX 1.5

### Issues Found
| Issue | Severity | Count |
|-------|----------|-------|
| Missing purl | Error | 15 components |
| Missing license | Warning | 8 components |
| Missing checksum | Info | 23 components |

### Components Without purl (Cannot Scan)
- component-a (no package URL)
- component-b (no package URL)

**Recommendation**: Request updated SBOM from supplier with package URLs.

阶段 2:安全扫描

目标:识别 SBOM 组件中的漏洞。

步骤 2.1:运行 SBOM 扫描

直接调用工具:

mcp_snyk_snyk_sbom_scan(file="path/to/sbom.json", severity_threshold="medium")
步骤 2.2:限定组织范围的扫描

如需应用特定组织的策略:

mcp_snyk_snyk_sbom_scan(file="path/to/sbom.json", org="<org-id>", severity_threshold="high")

阶段 3:风险分析

目标:根据扫描结果生成全面的风险报告。

生成一份综合报告,涵盖摘要、严重发现和总体风险评分:

## SBOM Security Analysis

### Overview
| Metric | Value |
|--------|-------|
| Total Components | 156 |
| Components Scanned | 141 |
| Components Skipped | 15 (missing purl) |
| Vulnerable Components | 23 |
| Total Vulnerabilities | 47 |

### Severity Breakdown
| Severity | Count |
|----------|-------|
| Critical | 3 |
| High | 12 |
| Medium | 18 |
| Low | 14 |

### Critical Vulnerabilities
| Component | Version | CVE | CVSS | Exploited |
|-----------|---------|-----|------|-----------|
| log4j-core | 2.14.1 | CVE-2021-44228 | 10.0 | Yes |
| spring-core | 5.3.17 | CVE-2022-22965 | 9.8 | Yes |
| jackson-databind | 2.9.10 | CVE-2020-36518 | 9.8 | No |

### Risk Score: 78/100 (High Risk)
- ⚠️ 2 vulnerabilities with known exploits
- ⚠️ 3 critical severity issues
- ✓ Components from untrusted sources: 0

**Recommendation**: Do not integrate this software until critical vulnerabilities are addressed.

阶段 4:修复建议

目标:提供可执行的升级建议和供应商沟通方案。

步骤 4.1:升级建议
## Recommended Actions

### Priority 1: Critical (Must Fix)
| Component | Current | Fixed Version | Notes |
|-----------|---------|---------------|-------|
| log4j-core | 2.14.1 | 2.17.1+ | Log4Shell |
| spring-core | 5.3.17 | 5.3.18+ | Spring4Shell |

### Priority 2: High (Should Fix)
| Component | Current | Fixed Version | Notes |
|-----------|---------|---------------|-------|
| lodash | 4.17.15 | 4.17.21 | Prototype pollution |
| axios | 0.21.1 | 1.6.0+ | SSRF vulnerability |

### Priority 3: Medium (Plan to Fix)
| Component | Current | Fixed Version | Notes |
|-----------|---------|---------------|-------|
| minimist | 1.2.5 | 1.2.8+ | Prototype pollution |
步骤 4.2:供应商沟通

使用以下模板起草发给供应商的消息(填入实际发现):

Subject: Security Vulnerabilities in Software SBOM

Dear [Vendor],

During our security review of [Product Name], we identified the following
vulnerabilities in the provided SBOM:

**Critical Issues (Require Immediate Action)**:
1. [Component] [Version] - [CVE] ([Name])
2. [Component] [Version] - [CVE] ([Name])

**Request**:
1. Provide updated software with patched versions
2. Provide updated SBOM reflecting the changes
3. Confirm expected remediation timeline

We require resolution of critical issues before proceeding with integration.

Regards,
[Your Name]

SBOM 生成(内部项目)

使用 Snyk CLI 为自己的项目生成 SBOM,然后进行扫描:

# Generate CycloneDX SBOM
snyk sbom --format=cyclonedx1.5+json > sbom.json

# Generate SPDX SBOM
snyk sbom --format=spdx2.3+json > sbom.json

然后扫描生成的 SBOM:

mcp_snyk_snyk_sbom_scan(file="sbom.json")

错误处理

SBOM 格式无效
Error: Unable to parse SBOM file

Solutions:
1. Verify file is valid JSON
2. Check SBOM format (CycloneDX/SPDX)
3. Validate against schema
4. Request corrected SBOM from source
缺少 Package URL
Warning: X components missing purl - cannot scan

Solutions:
1. Request updated SBOM with purls
2. Manually add purls if components are known
3. Document risk of unscanned components
不支持的版本
Error: SBOM version not supported

Supported versions:
- CycloneDX: 1.4, 1.5, 1.6
- SPDX: 2.3

Convert SBOM to supported version if possible.

限制

  1. 需要 purl:没有 Package URL 的组件无法扫描
  2. 仅支持 JSON:目前不支持 XML 格式
  3. 版本限制:仅支持特定版本的 CycloneDX/SPDX
  4. 需要网络:查询漏洞数据库需要网络连接
  5. 反映特定时点:SBOM 反映特定版本,更新后请重新扫描

评论

支持 Markdown