Syft Generation

syft-generation

Generates CycloneDX or SPDX SBOMs with Syft, scans them with Grype, diffs SBOMs in CI and explains how to choose a format.

When to use

Use for any question or task about SBOMs, including generating one for a container image or folder, adding SBOM generation and vulnerability scanning to a release job, compliance (US EO 14028, EU CRA, FDA) or drift between releases.

/plugin install qa-security-scanning@testland-qa

First time in Claude Code? Add the marketplace with /plugin marketplace add testland/qa

View source (opens in a new tab)

Overview

Per github.com/anchore/syft (opens in new window), Syft generates SBOMs from "container images, filesystems, archives" (OCI, Docker, Singularity). The SBOM is the input artifact for vuln scanning with Grype (Step 7), for SBOM-to-SBOM drift diffing (Step 8), and for compliance delivery in SPDX or CycloneDX format.

SBOMs are mandated by US EO 14028 (software sold to federal agencies), the EU Cyber Resilience Act (products with digital elements, in effect 2024+), and FDA medical-device guidance; internal supply-chain audits also need a full dependency manifest.

When to use

  • The team ships software to customers requiring an SBOM (federal, EU regulated, medical device, etc.).
  • Internal compliance program requires SBOM as evidence artifact.
  • The vuln-scanning workflow needs an SBOM input (Grype, OSV-Scanner with --sbom).
  • Container-image build pipelines need accompanying SBOM for delivery alongside the image.
  • A rebuilt image needs a dependency-drift check ("what changed in the inventory?") or a "no unexpected new transitive deps" release gate (Step 8).

Step 1 - Install

Per sf-gh (opens in new window):

# Homebrew
brew install syft

# Docker
docker run --rm -v "$PWD:/scan" anchore/syft scan dir:/scan -o cyclonedx-json

# Install script into a user-owned dir (-b sets the target; no sudo needed)
curl -sSfL https://get.anchore.io/syft | sh -s -- -b "$HOME/.local/bin"

Other paths (consult sf-gh (opens in new window)): Scoop, Chocolatey, Nix.

Step 2 - Basic SBOM generation

Per sf-gh (opens in new window):

# Container image
syft alpine:latest

# Local directory
syft ./my-project

# Specific output format to stdout
syft <image> -o cyclonedx-json

# Multiple formats to files in one pass
syft <image> -o spdx-json=./spdx.json -o cyclonedx-json=./cdx.json

The default output is the table format (human-readable); use explicit -o for machine-readable formats in CI.

Step 3 - Output format catalog

Per sf-gh (opens in new window), the common formats are cyclonedx-json (CycloneDX 1.5+, broad support), spdx-json (SPDX 2.3, preferred by US federal procurement), and syft-json (richest metadata). For Grype scan input (Step 7) use syft-json or cyclonedx-json; for compliance delivery the consumer dictates (SPDX-JSON US federal, CycloneDX-JSON most EU) - see references/sbom-formats.md for the format-choice guidance. The full format catalog is in references/formats.md.

Step 4 - Source types

Per sf-gh (opens in new window), the common sources are a local Docker image (syft alpine:latest), a remote registry (syft registry:docker.io/alpine:latest), an archive (syft oci-archive:./image.tar), and a directory (syft dir:./my-project). The full source-type syntax table is in references/formats.md.

Step 5 - Attestation pattern (cosign)

For supply-chain integrity, attach the SBOM to the container image via Sigstore cosign:

# Generate SBOM
syft my-image:1.0 -o cyclonedx-json=sbom.json

# Sign + attach to image (Sigstore)
cosign attest --predicate sbom.json --type cyclonedx my-image:1.0

# Verify
cosign verify-attestation --type cyclonedx my-image:1.0

The attestation lives alongside the image in the registry; downstream consumers can verify provenance + retrieve the SBOM.

Step 6 - False-positive triage analogue

Syft generates inventories, not findings - there's no FP triage per se. The analogue here is inventory accuracy: ensuring Syft correctly identifies all components.

MechanismUse
--exclude=PATH_PATTERNSkip directories from scan (vendor / generated)
--catalogers=CATALOGERRestrict to specific catalogers (e.g., npm, python)
--source-name=NAME / --source-version=VERSIONOverride SBOM-level metadata
--platform=linux/amd64Target specific platform for multi-arch images

Inventory accuracy validation:

# Compare two SBOMs (e.g., before vs after a build change)
syft image:1.0 -o syft-json=v1-sbom.json
syft image:1.1 -o syft-json=v1.1-sbom.json
diff <(jq -S . v1-sbom.json) <(jq -S . v1.1-sbom.json)

If Syft misses a component (false negative on inventory), the downstream vuln scan misses any CVEs against that component. Periodic accuracy validation against known dependencies catches this.

Step 7 - Generate + scan workflow (Grype)

Grype is the Anchore vuln scanner that pairs with Syft. Per github.com/anchore/grype (opens in new window), three input modes:

Input modeUse
Container imagegrype alpine:latest (Grype generates SBOM internally)
Directorygrype ./my-project (filesystem scan)
SBOM inputgrype sbom:./sbom.json (no re-generation; faster + auditable)

The SBOM-input mode is the recommended production pattern: generate the SBOM once via Syft (Step 2), attest via cosign (Step 5), then scan the SBOM. Decoupling gives an audit trail and allows re-scanning with a refreshed vuln DB without re-building. Per gr-gh (opens in new window), coverage spans major OS package ecosystems (Alpine, Debian, Ubuntu, RHEL, Amazon Linux) and language packages (Ruby, Java, JavaScript, Python, .NET, Go, PHP, Rust).

# Install (Homebrew, or the install script into a user-owned dir - no sudo)
brew install grype
# curl -sSfL https://get.anchore.io/grype | sh -s -- -b "$HOME/.local/bin"

# Scan the Syft-generated SBOM (recommended)
grype sbom:./sbom.json

# Output formats: table (default) / json / sarif / cyclonedx-json / template
grype sbom:./sbom.json -o sarif       # GitHub Code Scanning
grype sbom:./sbom.json -o json        # EPSS + KEV + risk-score annotations

# CI gate: exit 1 at/above severity; focus on upgradable findings
grype sbom:./sbom.json --fail-on high --only-fixed

Severity levels per gr-gh (opens in new window): critical, high, medium, low, negligible, unknown. The JSON output annotates findings with EPSS, KEV, and risk scoring for downstream prioritization.

Suppression (MANDATORY triage): Grype's native path is .grype.yaml ignore rules - per-CVE, per-package+version, or pattern-based (fix-state), each with a mandatory expires: date and a reachability reason:. Full config + justification template: references/grype-ignore-rules.md. OpenVEX status assertions (not_affected / fixed / etc., see vex-author) filter findings in a signed, machine-readable way. Audit ignore entries quarterly; expired entries are removed.

DB management for CI determinism - Grype's DB updates multiple times per day; pin per scan or results vary run to run:

grype db update                                # manual refresh
grype db status
grype db import grype-db-v6-2026-05-06.tar.gz  # pinned version for CI

CI wiring - anchore/scan-action wraps Grype + SARIF upload:

      - uses: anchore/scan-action@v5
        with:
          sbom: sbom.cyclonedx.json
          fail-build: true
          severity-cutoff: high
          output-format: sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with: { sarif_file: results.sarif }

Grype's DB is Anchore-curated; coverage differs from OSV.dev / Snyk / NVD - pair with OSV-Scanner or Snyk (dependency-vulnerability-scanning) for consensus. No reachability analysis: every CVE on a declared component counts.

Step 8 - Diffing SBOMs across versions

An SBOM diff turns two point-in-time inventories into a change signal: which components are net-new, removed, or version-changed between image or build versions. Per github.com/CycloneDX/cyclonedx-cli (opens in new window), the CycloneDX CLI provides a first-class diff subcommand accepting any two CycloneDX BOMs (XML, JSON, or Protobuf):

# Install: brew install cyclonedx/cyclonedx/cyclonedx-cli
#   or:    docker run cyclonedx/cyclonedx-cli ...

# Generate both inventories with the SAME source type + format
syft myapp:1.0 -o cyclonedx-json=sbom-v1.0.json
syft myapp:1.1 -o cyclonedx-json=sbom-v1.1.json

# Human-readable diff
cyclonedx diff sbom-v1.0.json sbom-v1.1.json --component-versions

# Machine-readable diff for CI gate logic
cyclonedx diff sbom-v1.0.json sbom-v1.1.json \
  --component-versions --output-format json > diff-result.json

Key flags per cdx-cli-gh (opens in new window): --component-versions (the signal flag - reports added / removed / version-changed components; without it only structural BOM changes are reported), --from-format / --to-format (autodetect / json / xml / protobuf), --output-format (text / json).

The JSON output carries three lists: added (net-new deps - review every entry: expected transitive dep, base-image update, or supply-chain risk), removed (may hide a dep renamed by a packaging change), and modified (version changes with old + new values). Minimal CI gate:

ADDED=$(jq '.added | length' diff-result.json)
if [ "$ADDED" -gt "0" ]; then
  echo "::error::Net-new components detected. Review diff-result.json."
  jq '.added' diff-result.json
  exit 1
fi

The full GitHub Actions gate with allowlist-subtraction, plus the nightly-drift workflow (diff production tag vs last known-good SBOM, rotate the baseline only on a clean diff), are in references/diff-ci-workflows.md.

Diff rules of thumb: always pass --component-versions; generate both SBOMs with the same tool, format, and source type (dir: vs image scope mismatch produces noisy diffs); diff multi-arch images per-platform (--platform=linux/amd64 on both runs); SPDX SBOMs need cyclonedx convert first. The diff shows inventory change, not vulnerability change - scan net-new components with Grype (Step 7).

Step 9 - CI integration

jobs:
  sbom:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: anchore/sbom-action@v0
        with:
          path: ./
          format: cyclonedx-json
          output-file: sbom.cyclonedx.json
      - uses: anchore/sbom-action@v0
        with:
          path: ./
          format: spdx-json
          output-file: sbom.spdx.json
      - uses: actions/upload-artifact@v4
        with:
          name: sboms
          path: sbom.*.json

The anchore/sbom-action GHA wraps Syft + handles GitHub dependency-graph submission automatically when format: github-json.

Step 10 - Composition with sister tools

Sister toolUse
trivy-imageAlternative scanner (built-in SBOM gen + scan in one pass)
vex-authorOpenVEX documents that filter Grype findings (Step 7)
dependency-vulnerability-scanningOSV-Scanner and Snyk also accept SBOM input

Anti-patterns

Anti-patternWhy it failsFix
Generate SBOM only at release timeMisses build-time inventory differencesGenerate per CI build + attest
Use single format onlyDifferent consumers need different formatsGenerate both CycloneDX + SPDX (Step 2)
Skip platform targeting on multi-arch imagesMisses platform-specific deps--platform=linux/amd64 (Step 6)
Generate SBOM but don't attest / signProvenance unverifiable downstreamCosign attest pattern (Step 5)
Trust Syft inventory without validationMisses components → misses CVEsPeriodic accuracy check (Step 6)
Re-generate SBOM via Grype on every scanSlow + non-deterministic; SBOM lives outside scanUse sbom: input mode (Step 7)
.grype.yaml ignore without expires:Permanent debtMandatory expires: (Step 7)
Skip Grype DB pin in CIDifferent DB version per run; non-deterministicPin DB version (Step 7)
Diff without --component-versionsReports only structural BOM changes, not inventory deltaAlways pass the flag (Step 8)
Diff SBOMs from different tools / scan depthsFormat + scope mismatches appear as false diffsSame generator, format, source type (Step 8)

Limitations

  • Syft can't scan what it can't see - encrypted archives, custom package formats may produce incomplete SBOMs.
  • Some language-specific catalogers have edge cases (e.g., npm workspaces, Python wheel quirks); validate against known deps.
  • SBOM generation alone doesn't prove the deps are vulnerability-free - run the Grype scan step (Step 7).
  • Multi-arch container scanning is per-platform; combine SBOMs manually or via tooling for unified view.
  • Grype includes no reachability analysis, and its DB coverage differs from OSV.dev / Snyk / NVD (Step 7).
  • cyclonedx diff operates on CycloneDX only; SPDX SBOMs require cyclonedx convert first (Step 8).

References

Reference

CycloneDX component types and per-language tooling

View source (opens in a new tab) (opens in new window)

Reference tables extracted from cyclonedx-format. See cyclonedx.org/specification/overview (opens in new window) for the source spec.

Component types

Per cdx-spec (opens in new window) common component types:

TypeUse
applicationTop-level app being described
libraryCode dependency (npm, pip, Maven artifact)
frameworkApplication framework (React, Django, Spring)
containerOCI/Docker container image
operating-systemOS (Alpine, Ubuntu, etc.)
firmwareEmbedded firmware
deviceHardware device
fileStandalone file (script, binary)
machine-learning-modelML model (since 1.5)
dataDataset (since 1.5)
cryptographic-assetCrypto algorithm/key (since 1.6)

The purl (Package URL) field is the canonical identifier per github.com/package-url/purl-spec (opens in new window).

Per-language native tooling

CycloneDX has per-language native generators (alternative to Syft):

LanguageToolSource
Node.js@cyclonedx/cyclonedx-npmgithub.com/CycloneDX/cyclonedx-node-npm
Pythoncyclonedx-py (cyclonedx-bom)github.com/CycloneDX/cyclonedx-python
Java/Mavencyclonedx-maven-plugingithub.com/CycloneDX/cyclonedx-maven-plugin
Java/Gradlecyclonedx-gradle-plugingithub.com/CycloneDX/cyclonedx-gradle-plugin
Gocyclonedx-gomodgithub.com/CycloneDX/cyclonedx-gomod
.NETCycloneDX-DOTNETgithub.com/CycloneDX/cyclonedx-dotnet
Rustcargo-cyclonedxgithub.com/CycloneDX/cyclonedx-rust-cargo

Per-language tools often produce richer SBOMs than Syft (deeper metadata, language-specific quirks handled).

Full GitHub Actions workflows for the SBOM-diff step of syft-generation. The SKILL.md spine keeps the minimal jq gate; the complete CI-gate job, the allowlist pattern, and the nightly drift-detection workflow live here.

CI gate on net-new components

- name: SBOM diff gate
  run: |
    ADDED=$(jq '.added | length' diff-result.json)
    echo "Net-new components: $ADDED"
    if [ "$ADDED" -gt "0" ]; then
      echo "::error::Net-new components detected. Review diff-result.json."
      jq '.added' diff-result.json
      exit 1
    fi

To allow a pre-approved set of additions (a known intentional dependency upgrade), maintain an allowlist and subtract matches before the count check:

UNAPPROVED=$(jq --rawfile allow allowlist.txt \
  '[.added[] | select(.name as $n | $allow | test($n) | not)] | length' \
  diff-result.json)

Adjust the gate threshold and allowlist policy to the team's change-control requirements; the CI step above enforces zero-tolerance as the strictest form.

Nightly drift detection

For production image monitoring, run a nightly diff against the last known-good SBOM rather than comparing two build artifacts:

jobs:
  sbom-drift:
    runs-on: ubuntu-latest
    schedule:
      - cron: "0 2 * * *"
    steps:
      - name: Generate current SBOM
        run: syft myapp:production -o cyclonedx-json=sbom-current.json

      - name: Download last known-good SBOM
        run: |
          aws s3 cp s3://sbom-store/sbom-last-good.json sbom-baseline.json

      - name: Diff
        run: |
          cyclonedx diff sbom-baseline.json sbom-current.json \
            --component-versions --output-format json \
            > drift-result.json

      - name: Alert on drift
        run: |
          ADDED=$(jq '.added | length' drift-result.json)
          REMOVED=$(jq '.removed | length' drift-result.json)
          if [ "$ADDED" -gt "0" ] || [ "$REMOVED" -gt "0" ]; then
            echo "Supply-chain drift detected"
            cat drift-result.json
            # Pipe to Slack/PagerDuty/JIRA as needed
            exit 1
          fi

      - name: Rotate known-good on clean diff
        if: success()
        run: aws s3 cp sbom-current.json s3://sbom-store/sbom-last-good.json

The "rotate known-good on clean diff" step ensures the baseline advances only when the image passes the gate, catching regressions introduced in a later build.

Reference

Syft output formats and source types

View source (opens in a new tab) (opens in new window)

Full catalogs extracted from syft-generation. Per github.com/anchore/syft (opens in new window), Syft supports multiple SBOM output formats and scan-source types; the SKILL.md spine keeps the common ones inline and links here for the complete tables.

Output format catalog

FormatUse
cyclonedx-jsonCycloneDX 1.5+ JSON; broad ecosystem support
cyclonedx-xmlCycloneDX XML (older toolchains)
spdx-jsonSPDX 2.3 JSON; preferred by US Federal procurement
spdx-tag-valueSPDX tag-value format (legacy)
syft-jsonSyft-native JSON; richest metadata
tableHuman-readable terminal table (default)
github-jsonGitHub dependency-graph submission format

For Grype scan input (SKILL.md Step 7), use syft-json (richest metadata) or cyclonedx-json (broader compat). For compliance delivery, the consumer's requirement dictates: SPDX-JSON for US federal, CycloneDX-JSON for most EU contexts.

Source types

SourceSyntax
Local Docker daemonsyft alpine:latest
OCI / remote registrysyft registry:docker.io/alpine:latest
OCI archive (tar)syft oci-archive:./image.tar
Docker archive (tar)syft docker-archive:./image.tar
Local directorysyft dir:./my-project (or syft ./my-project)
Filesyft file:./pom.xml
Singularity imagesyft singularity:./image.sif
Reference

Grype `.grype.yaml` ignore rules

View source (opens in a new tab) (opens in new window)

Full suppression examples for the Grype scan step of syft-generation. Per github.com/anchore/grype (opens in new window): "Configuration can be managed through .grype.yaml files with ignore rules for customized scanning behavior."

Example config

# .grype.yaml
ignore:
  # Per-CVE ignore
  - vulnerability: CVE-2024-1234
    reason: "Reachability analysis confirms unreachable; tracked in JIRA-1234"
    expires: 2026-12-15

  # Per-package + version ignore
  - package:
      name: lodash
      version: 4.17.20
    vulnerability: CVE-2024-5678
    reason: "Test fixture; not in production dependency graph"
    expires: 2026-09-30

  # Pattern-based ignore (per-fix-state)
  - vulnerability: GHSA-*
    fix-state: not-fixed
    reason: "Pending vendor fix; not exploitable in our context"
    expires: 2026-12-15

Justification template (mandatory in .grype.yaml)

Every ignore entry needs a reachability reason, an approver, and an expiry date:

ignore:
  - vulnerability: CVE-2024-1234
    reason: |
      Reachability: vulnerable function `parse_xml` not called from
      production code paths (verified via static analysis 2026-05-15).
      Component is required for test fixtures only.
    approved-by: alice@example.com
    expires: 2026-09-15
    re-review-date: 2026-09-15
Reference

SBOM formats: CycloneDX and SPDX

View source (opens in a new tab) (opens in new window)

Overview

Two specification families dominate the SBOM landscape. CycloneDX is the OWASP-curated, security-focused format and this file's primary subject; SPDX is the Linux Foundation's license-focused standard, covered in spdx.md (opens in new window).

Per cyclonedx.org/specification/overview (opens in new window), CycloneDX's distinguishing features vs SPDX:

  • Vulnerability schema - first-class vulnerabilities[] block with VEX-style status assertions
  • Services + dataflow - services[] block describes service endpoints + data flows
  • Formulation - describes how the software was built (build steps, tools, env)
  • ML BOMs (CycloneDX 1.5+) - first-class ML model + dataset components
  • SaaS BOMs - describes hosted services not just shipped artifacts

This reference defines the schemas and tooling landscape; the main skill generates SBOMs in either format from real codebases.

Choosing a format

SignalPick
Security-focused consumer (vuln tracking, supply-chain attestation)CycloneDX
US Federal procurement (NIST SP 800-218 + EO 14028 guidance)SPDX (spdx.md (opens in new window))
License-compliance focus (richest license-expression vocabulary)SPDX
Linux Foundation member organization workflowSPDX
EU consumers / broad modern toolingCycloneDX (most common)
Consumer dictates the formatWhatever the consumer requires

When no consumer constraint exists, CycloneDX is the default here: its embedded VEX (vulnerabilities[].analysis) feeds the triage workflow directly. Generating both (Syft emits either) satisfies mixed audiences. Note SPDX license IDs are the cross-format standard - even CycloneDX license blocks use them.

When to use

  • The team adopts CycloneDX as the primary SBOM format, or must pick a format (see Choosing a format).
  • The use case is security-focused (vuln tracking, supply-chain attestation) over licensing-focused.
  • A consumer (vendor, customer, regulator) requires CycloneDX or SPDX format specifically (SPDX: spdx.md (opens in new window)).
  • Per-language CycloneDX-native tooling is preferred over Syft+convert.

How to use

Work the numbered Steps in order: generate the BOM (Steps 1-2), add a VEX-style analysis record per triaged finding (Steps 3, 5), validate against the schema (Step 4), then sign + attest in CI (Step 6). Pin the specVersion your consumer agreed; bump version on each re-issue. For an SPDX consumer, follow spdx.md (opens in new window) instead.

Step 1 - Top-level structure

A minimal CycloneDX 1.6 BOM (JSON):

{
  "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
  "bomFormat": "CycloneDX",
  "specVersion": "1.6",
  "serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
  "version": 1,
  "metadata": {
    "timestamp": "2026-05-06T12:00:00Z",
    "tools": [{"vendor": "anchore", "name": "syft", "version": "1.16.0"}],
    "component": {
      "type": "application",
      "name": "my-app",
      "version": "1.0.0",
      "purl": "pkg:generic/my-app@1.0.0"
    }
  },
  "components": [
    {
      "type": "library",
      "bom-ref": "pkg:npm/lodash@4.17.20",
      "name": "lodash",
      "version": "4.17.20",
      "purl": "pkg:npm/lodash@4.17.20",
      "licenses": [{"license": {"id": "MIT"}}]
    }
  ],
  "dependencies": [
    {
      "ref": "pkg:generic/my-app@1.0.0",
      "dependsOn": ["pkg:npm/lodash@4.17.20"]
    }
  ]
}

Step 2 - Required fields per spec

Per cdx-spec (opens in new window):

FieldRequired?Use
bomFormatyesMust be "CycloneDX"
specVersionyes"1.6" (current) / "1.5" / "1.4"
serialNumberrecommendedURN UUID identifying the BOM
versionrecommendedBOM revision (incremented per re-issue)
metadatarecommendedGeneration context (timestamp, tools, top-level component)
components[]required for non-empty BOMsInventory of dependencies
dependencies[]recommendedDependency-graph edges via bom-ref
services[]optionalHosted services (SaaS BOM)
vulnerabilities[]optionalPer-finding records
formulation[]optionalBuild metadata

Component types and per-language native generators are cataloged in component-types-and-tooling.md (opens in new window); the purl (Package URL) field is the canonical component identifier.

Step 3 - Vulnerability block (VEX-equivalent)

CycloneDX has first-class vuln support (unlike SPDX which delegates to companion files):

"vulnerabilities": [
  {
    "id": "CVE-2024-1234",
    "source": {"name": "NVD", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-1234"},
    "ratings": [
      {"source": {"name": "NVD"}, "severity": "critical", "method": "CVSSv3", "score": 9.8}
    ],
    "cwes": [798],
    "description": "Hardcoded credential in lodash sortBy function",
    "affects": [{"ref": "pkg:npm/lodash@4.17.20"}],
    "analysis": {
      "state": "not_affected",
      "justification": "code_not_present",
      "detail": "Vulnerable function not exported in current build"
    }
  }
]

The analysis.state field uses VEX-equivalent values: resolved, resolved_with_pedigree, exploitable, in_triage, false_positive, not_affected.

Step 4 - Validation

Validate a CycloneDX SBOM against the schema:

# Using cyclonedx-cli
cyclonedx validate --input-file sbom.json --input-version v1_6

# Or via npm
npx @cyclonedx/cyclonedx-bom validate sbom.json

Validation catches structural issues (missing required fields, invalid PURLs, unknown component types) before publishing. For SPDX validation (pyspdxtools), see spdx.md (opens in new window).

Step 5 - VEX integration

The Step 3 vulnerabilities[] record IS embedded VEX (Vulnerability Exploitability Exchange, CycloneDX 1.4+). To assert a triaged CVE does not affect the shipped product, extend that same record - deltas only:

  • analysis.justification: "vulnerable_code_not_in_execute_path" with a concrete analysis.detail (e.g. "vulnerable parser only invoked under --debug; production builds disable it").
  • analysis.response: ["will_not_fix"] - the planned action.

This lets downstream consumers filter the false-positive finding instead of re-doing reachability analysis.

Step 6 - CI integration

jobs:
  cyclonedx:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      # Per-language native (recommended for richer SBOM)
      - run: npx @cyclonedx/cyclonedx-npm --output-file=sbom.cyclonedx.json
      # OR via Syft (broader source coverage)
      - uses: anchore/sbom-action@v0
        with:
          format: cyclonedx-json
          output-file: sbom.cyclonedx.json
      # Validate
      - run: cyclonedx validate --input-file sbom.cyclonedx.json --input-version v1_6
      # Sign + attest
      - run: cosign attest --predicate sbom.cyclonedx.json --type cyclonedx my-image:1.0

Worked example

A Node.js service must ship a CycloneDX SBOM to a security-focused customer. The team:

  1. Generates the BOM natively: npx @cyclonedx/cyclonedx-npm --output-file=sbom.cyclonedx.json. Output is bomFormat: "CycloneDX", specVersion: "1.6", with a components[] entry per dependency (each carrying a purl) and a dependencies[] edge list.
  2. A scan flags CVE-2024-1234 on pkg:npm/lodash@4.17.20. Triage shows the vulnerable function is not in the execute path, so the team adds a vulnerabilities[] record with analysis.state: "not_affected" and justification: "vulnerable_code_not_in_execute_path" (Step 3).
  3. Validates: cyclonedx validate --input-file sbom.cyclonedx.json --input-version v1_6 - passes.
  4. Attests to the image: cosign attest --predicate sbom.cyclonedx.json --type cyclonedx my-image:1.0.

Result: a schema-valid, attested CycloneDX 1.6 BOM whose embedded VEX lets the customer drop the lodash finding without re-doing reachability analysis.

Anti-patterns

Anti-patternWhy it failsFix
Skip serialNumber fieldCan't deduplicate across re-generationsGenerate URN UUID per BOM
Use metadata.tools[] v1.4 schema in 1.6+Schema evolution; tools shape changedUse metadata.tools.components[] (newer schema)
Skip dependencies[] blockLoss of dep-graph info; downstream tools degradeAlways include (Step 1)
Hand-author CycloneDXSchema is large; errors easy to introduceUse generators (references (opens in new window))
Skip schema validationInvalid SBOMs pass into prod; downstream consumers failValidate in CI (Step 4)
Pick format by tooling habit, not consumerConsumer rejects the deliveryFormat-choice table (Choosing a format)

Limitations

  • Both specs are large + evolve; pin schema version per consumer agreement.
  • Per-language tools have varying quality; some are community-maintained
    • occasionally lag releases.
  • VEX assertions are only as good as the analysis behind them; unfounded not_affected claims are worse than no claim.
  • ML / SaaS BOM features are newer (CycloneDX 1.5+) and not all tooling supports them.
  • SPDX-specific limitations (weaker vuln support, strict license expressions, 3.0 tooling maturity) are in spdx.md (opens in new window).

References

Reference

SPDX - Software Package Data Exchange (format reference)

View source (opens in a new tab) (opens in new window)

Companion reference for sbom-formats.md (opens in new window). Consult when the SBOM consumer requires SPDX (US Federal procurement, Linux Foundation members, license-compliance focus); the SKILL.md covers CycloneDX and the format-choice guidance.

SPDX is the Linux Foundation's SBOM standard, originally focused on license compliance. Per spdx.org/specifications (opens in new window):

Two active major versions:

VersionStatusNotable
SPDX 2.3Stable; broadly tooledTag-Value / JSON / YAML / RDF / Spreadsheet; ISO/IEC 5962:2021
SPDX 3.0Recent (2024); growing toolingProfile-based: core + software + AI + dataset + build + security; JSON-LD primary

When SPDX is the right format

  • US Federal procurement context (NIST SP 800-218 + EO 14028 guidance favor SPDX).
  • Linux Foundation member organization workflow.
  • License-compliance focused use case (SPDX has the richest license-expression vocabulary).
  • A consumer (regulator, customer) requires SPDX format specifically.

SPDX 2.3 top-level structure (JSON)

{
  "spdxVersion": "SPDX-2.3",
  "dataLicense": "CC0-1.0",
  "SPDXID": "SPDXRef-DOCUMENT",
  "name": "my-app-1.0.0-sbom",
  "documentNamespace": "https://example.com/spdx/my-app/1.0.0",
  "creationInfo": {
    "created": "2026-05-06T12:00:00Z",
    "creators": ["Tool: syft-1.16.0", "Organization: Acme Corp"]
  },
  "packages": [
    {
      "SPDXID": "SPDXRef-Package-myapp",
      "name": "my-app",
      "versionInfo": "1.0.0",
      "downloadLocation": "NOASSERTION",
      "filesAnalyzed": false,
      "licenseConcluded": "Apache-2.0",
      "licenseDeclared": "Apache-2.0"
    },
    {
      "SPDXID": "SPDXRef-Package-lodash",
      "name": "lodash",
      "versionInfo": "4.17.20",
      "downloadLocation": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
      "filesAnalyzed": false,
      "licenseConcluded": "MIT",
      "licenseDeclared": "MIT"
    }
  ],
  "relationships": [
    {
      "spdxElementId": "SPDXRef-DOCUMENT",
      "relationshipType": "DESCRIBES",
      "relatedSpdxElement": "SPDXRef-Package-myapp"
    },
    {
      "spdxElementId": "SPDXRef-Package-myapp",
      "relationshipType": "DEPENDS_ON",
      "relatedSpdxElement": "SPDXRef-Package-lodash"
    }
  ]
}

Required fields per SPDX 2.3

Per spdx-spec (opens in new window):

FieldRequired?Use
spdxVersionyesMust be "SPDX-2.3"
dataLicenseyes"CC0-1.0" (CC0 - the SBOM data itself)
SPDXIDyes"SPDXRef-DOCUMENT"
nameyesHuman-readable doc name
documentNamespaceyesUnique URI per BOM revision
creationInfo.createdyesISO 8601 timestamp
creationInfo.creatorsyesTool / org / person who created
packages[]required for non-empty BOMInventory
relationships[]required (at least DESCRIBES)Dep graph

License expressions

SPDX is the canonical source for license identifiers (cross-format standard - even CycloneDX uses SPDX license IDs).

"licenseConcluded": "Apache-2.0",
"licenseConcluded": "MIT OR Apache-2.0",
"licenseConcluded": "(MIT AND BSD-3-Clause) OR GPL-2.0-only WITH Classpath-exception-2.0"

Full list: spdx.org/licenses (current count ~600+).

The LicenseRef- prefix declares custom licenses:

"hasExtractedLicensingInfos": [{
  "licenseId": "LicenseRef-AcmeProprietary",
  "extractedText": "Acme Proprietary License Text..."
}],
"licenseConcluded": "LicenseRef-AcmeProprietary"

Relationships

The relationships[] block is the dep-graph (SPDX equivalent of CycloneDX's dependencies[]):

RelationshipTypeUse
DESCRIBES / DESCRIBED_BYDocument to top-level package
DEPENDS_ON / DEPENDENCY_OFCompile-time / runtime dep
BUILD_DEPENDENCY_OFBuild-only dep
DEV_DEPENDENCY_OFTest/dev-only dep
RUNTIME_DEPENDENCY_OFRuntime-only dep
OPTIONAL_DEPENDENCY_OFOptional dep
CONTAINS / CONTAINED_BYContainer to contained file/package
GENERATED_FROMSource-of-build
STATIC_LINK / DYNAMIC_LINKLinkage type

Tag-Value format (SPDX-native)

Some toolchains use the SPDX Tag-Value format (older but well-tooled):

SPDXVersion: SPDX-2.3
DataLicense: CC0-1.0
SPDXID: SPDXRef-DOCUMENT
DocumentName: my-app-1.0.0-sbom
DocumentNamespace: https://example.com/spdx/my-app/1.0.0
Creator: Tool: syft-1.16.0
Creator: Organization: Acme Corp
Created: 2026-05-06T12:00:00Z

PackageName: my-app
SPDXID: SPDXRef-Package-myapp
PackageVersion: 1.0.0
PackageDownloadLocation: NOASSERTION
FilesAnalyzed: false
PackageLicenseConcluded: Apache-2.0
PackageLicenseDeclared: Apache-2.0

Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package-myapp

JSON is preferred for new toolchains; Tag-Value persists for legacy integrations.

SPDX 3.0 profiles and the SPDX tooling landscape are cataloged in spdx3-profiles-and-tooling.md (opens in new window); for most teams, stay on SPDX 2.3 unless 3.0 features are required.

Validation

# Python spdx-tools
pip install spdx-tools
pyspdxtools --infile sbom.spdx.json --version SPDX-2.3
# Validates structural conformance + license-expression syntax

# Validation via spdx online tool
# Upload to https://tools.spdx.org/app/

CI integration

jobs:
  spdx:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: anchore/sbom-action@v0
        with:
          format: spdx-json
          output-file: sbom.spdx.json
      - run: |
          pip install spdx-tools
          pyspdxtools --infile sbom.spdx.json --version SPDX-2.3
      - uses: actions/upload-artifact@v4
        with:
          name: spdx-sbom
          path: sbom.spdx.json

Worked example

A team must deliver an SPDX 2.3 SBOM to a US Federal procurement consumer for an app that bundles one proprietary component:

  1. Generates via Syft in CI: anchore/sbom-action with format: spdx-json, producing sbom.spdx.json with spdxVersion: "SPDX-2.3", dataLicense: "CC0-1.0", and a unique documentNamespace.
  2. The app package uses a non-standard license, so the team declares it via hasExtractedLicensingInfos and sets licenseConcluded: "LicenseRef-AcmeProprietary"; every third-party package keeps its standard SPDX ID (MIT, etc.).
  3. Adds relationships[]: SPDXRef-DOCUMENT DESCRIBES the app package, and the app DEPENDS_ON each dependency.
  4. Validates: pyspdxtools --infile sbom.spdx.json --version SPDX-2.3 - structural + license-expression checks pass.

Result: a validated SPDX 2.3 JSON SBOM whose custom license resolves cleanly and whose relationship graph satisfies the federal consumer's format requirement.

SPDX anti-patterns

Anti-patternWhy it failsFix
Skip documentNamespaceCan't deduplicate across BOM revisionsGenerate unique URI per BOM
Use SPDX 3.0 with consumer expecting 2.3Tooling incompatStick to SPDX 2.3 unless 3.0 required
Manual license assignment without LicenseRef- for customLicense-expression validation failsUse proper SPDX license ID or LicenseRef-
Skip relationships[] (just packages)No dep-graph; downstream tools degradeAlways include DESCRIBES + DEPENDS_ON
Mix Tag-Value + JSON in same workflowToolchain confusionPick one format per workflow

SPDX limitations

  • SPDX 2.3 vuln support is weaker than CycloneDX 1.6 (no first-class vulnerabilities block - relies on companion VEX docs).
  • License-expression validation is strict; non-standard licenses require LicenseRef- boilerplate.
  • SPDX 3.0 tooling is still maturing; many tools still produce 2.3.
  • Tag-Value parsing is whitespace-sensitive; subtle formatting bugs.

Sources

Extended reference for the SPDX chapter of sbom-formats.md (opens in new window) (see spdx.md (opens in new window)). See spdx.dev/specifications (opens in new window) for the source spec.

SPDX 3.0 profiles

SPDX 3.0 (2024 release) restructures into composable profiles:

ProfileUse
coreMinimum BOM model
softwareSoftware-specific extensions (approx. SPDX 2.3 packages)
licensingLicense identification + expressions
securityVulnerability + VEX statements
aiAI/ML models, datasets, hyperparameters
datasetDataset-specific metadata
buildBuild provenance (similar to in-toto attestations)

JSON-LD is the primary encoding; tooling support is growing but less mature than 2.3 as of 2026. For most teams, stay on SPDX 2.3 unless 3.0 features are required - 2.3 has broader tooling.

Tooling

ToolUse
syftGenerates SPDX 2.3 (JSON / Tag-Value); cross-source
spdx-toolsReference impl (Python); validation + conversion
spdx-tools-javaJava reference impl
ORT (OSS Review Toolkit)License compliance scanning + SPDX reporting
spdx-sbom-generatorPer-language native generation
ternContainer image SPDX generation
TrivyCross-purpose scanner with SPDX output

Get new posts by email.

Occasional email with new Testland posts and plugin releases.

Unsubscribe any time. Privacy policy