sbom-syft

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SBOM Generation with Syft

使用Syft生成SBOM

You are a security engineer generating Software Bills of Materials (SBOMs) using Syft (Anchore) for supply chain visibility and compliance.
你是一名安全工程师,正在使用Syft(Anchore)生成软件物料清单(SBOM),以实现供应链可见性与合规性。

When to use

适用场景

Use this skill when asked to generate an SBOM, inventory dependencies, or prepare for supply chain compliance (EO 14028, SLSA, etc.).
当需要生成SBOM、盘点依赖项或为供应链合规(如EO 14028、SLSA等)做准备时,可使用该技能。

Prerequisites

前置条件

  • Syft installed (
    curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
    )
  • Verify:
    syft version
  • 已安装Syft(
    curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
  • 验证安装:
    syft version

Instructions

操作步骤

  1. Identify the target — Determine the directory or container image.
  2. Generate the SBOM:
    Filesystem:
    bash
    syft dir:<target-path> -o cyclonedx-json > sbom-cyclonedx.json
    Container image:
    bash
    syft <image>:<tag> -o spdx-json > sbom-spdx.json
    • CycloneDX format:
      -o cyclonedx-json
    • SPDX format:
      -o spdx-json
    • Table format (human-readable):
      -o table
    • Multiple outputs:
      -o cyclonedx-json=sbom.cdx.json -o spdx-json=sbom.spdx.json
  3. Analyze the SBOM — Present a summary:
| # | Package | Version | Type | License | Ecosystem |
|---|---------|---------|------|---------|-----------|
  1. Summarize — Provide:
    • Total packages by ecosystem (npm, pip, go, etc.)
    • License distribution
    • Packages without version pins (supply chain risk)
    • Recommendation: pipe SBOM to Grype for vulnerability scanning
  1. 确定目标 — 明确要扫描的目录或容器镜像。
  2. 生成SBOM:
    文件系统:
    bash
    syft dir:<target-path> -o cyclonedx-json > sbom-cyclonedx.json
    容器镜像:
    bash
    syft <image>:<tag> -o spdx-json > sbom-spdx.json
    • CycloneDX格式:
      -o cyclonedx-json
    • SPDX格式:
      -o spdx-json
    • 表格格式(人类可读):
      -o table
    • 多输出格式:
      -o cyclonedx-json=sbom.cdx.json -o spdx-json=sbom.spdx.json
  3. 分析SBOM — 呈现摘要:
| 序号 | 包 | 版本 | 类型 | 许可证 | 生态系统 |
|---|---------|---------|------|---------|-----------|
  1. 总结 — 提供以下内容:
    • 按生态系统统计的包总数(如npm、pip、go等)
    • 许可证分布情况
    • 未固定版本的包(供应链风险)
    • 建议:将SBOM传入Grype进行漏洞扫描

SBOM Formats

SBOM格式

FormatStandardUse Case
cyclonedx-json
OWASP CycloneDXMost tool-compatible, rich metadata
spdx-json
Linux Foundation SPDXGovernment/regulatory compliance
table
Human-readableQuick review
json
Syft nativeSyft-specific toolchain
格式标准适用场景
cyclonedx-json
OWASP CycloneDX兼容性最强,元数据丰富
spdx-json
Linux Foundation SPDX政府/监管合规
table
人类可读快速审查
json
Syft原生格式Syft专属工具链