Software Bill of Materials (SBOM) generation using Syft for container images, filesystems, and archives. Detects packages across 28+ ecosystems with multi-format output support (CycloneDX, SPDX, syft-json). Enables vulnerability assessment, license compliance, and supply chain security. Use when: (1) Generating SBOMs for container images or applications, (2) Analyzing software dependencies and packages for vulnerability scanning, (3) Tracking license compliance across dependencies, (4) Integrating SBOM generation into CI/CD for supply chain security, (5) Creating signed SBOM attestations for software provenance.
Syft is a CLI tool and Go library for generating comprehensive Software Bills of Materials (SBOMs) from container images and filesystems. It provides visibility into packages and dependencies across 28+ ecosystems, supporting multiple SBOM formats (CycloneDX, SPDX) for vulnerability management, license compliance, and supply chain security.
Languages & Package Managers: Alpine (apk), C/C++ (conan), Dart (pub), Debian/Ubuntu (dpkg), Dotnet (deps.json), Go (go.mod), Java (JAR/WAR/EAR/Maven/Gradle), JavaScript (npm/yarn), PHP (composer), Python (pip/poetry/setup.py), Red Hat (RPM), Ruby (gem), Rust (cargo), Swift (cocoapods)
Container & System: OCI images, Docker images, Singularity, container layers, Linux distributions
Generate SBOM for container image:
# Using Docker
docker run --rm -v $(pwd):/out anchore/syft:latest <image> -o cyclonedx-json=/out/sbom.json
# Local installation
syft <image> -o cyclonedx-json=sbom.json
# Examples
syft alpine:latest -o cyclonedx-json
syft docker.io/nginx:latest -o spdx-json
syft dir:/path/to/project -o cyclonedx-json
For creating SBOMs of container images:
syft <image-name:tag> -o cyclonedx-json=sbom-cyclonedx.json
syft <image-name:tag> \
-o cyclonedx-json=sbom-cyclonedx.json \
-o spdx-json=sbom-spdx.json \
-o syft-json=sbom-syft.json
Progress: [ ] 1. Add Syft to build pipeline after image creation [ ] 2. Generate SBOM in standard format (CycloneDX or SPDX) [ ] 3. Store SBOM as build artifact [ ] 4. Scan SBOM for vulnerabilities (using Grype or similar) [ ] 5. Fail build on critical vulnerabilities or license violations [ ] 6. Publish SBOM alongside container image [ ] 7. Integrate with vulnerability management platform
Work through each step systematically. Check off completed items.
For generating SBOMs from source code or filesystems:
syft dir:/path/to/project -o cyclonedx-json=app-sbom.json
.syft.yaml)Combining SBOM generation with vulnerability assessment:
syft <target> -o cyclonedx-json=sbom.json
grype sbom:sbom.json -o json --file vulnerabilities.json
For creating cryptographically signed SBOM attestations:
# macOS
brew install cosign
# Linux
wget https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64
chmod +x cosign-linux-amd64
mv cosign-linux-amd64 /usr/local/bin/cosign
syft <image> -o cyclonedx-json=sbom.json
cosign attest --predicate sbom.json --type cyclonedx <image>
cosign verify-attestation --type cyclonedx <image>
Syft supports multiple SBOM formats for different use cases:
| Format | Use Case | Specification |
|---|---|---|
cyclonedx-json | Modern SBOM standard, wide tool support | CycloneDX 1.4+ |
cyclonedx-xml | CycloneDX XML variant | CycloneDX 1.4+ |
spdx-json | Linux Foundation standard | SPDX 2.3 |
spdx-tag-value | SPDX text format | SPDX 2.3 |
syft-json | Syft native format (most detail) | Syft-specific |
syft-text | Human-readable console output | Syft-specific |
github-json | GitHub dependency submission | GitHub-specific |
template | Custom Go template output | User-defined |
Specify with -o flag:
syft <target> -o cyclonedx-json=output.json
Create .syft.yaml in project root or home directory:
# Cataloger configuration