Using syft - SethBodine/audit-tools GitHub Wiki

Using syft

Syft is a software bill of materials (SBOM) generator for container images and filesystems. It catalogues all packages, libraries, and dependencies it finds and produces output in a range of standard SBOM formats. Its output can be consumed directly by grype for vulnerability scanning.

  • Generates SBOMs for container images, directories, and archives
  • Supports SPDX, CycloneDX, and Syft-native JSON formats
  • Works with images from Docker, GHCR, and other registries
  • Output can be piped directly into grype

Prepare the Environment

No setup required. Run from the shell.

Gather Data

Container Image

syft <image-name>:<tag>                # e.g. syft nginx:latest
syft <image-name> -o json             # JSON output

Filesystem / Local Directory

syft dir:<path>                        # e.g. syft dir:.

Output Formats

syft <image-name> -o spdx-json > /output/sbom.spdx.json
syft <image-name> -o cyclonedx-json > /output/sbom.cyclonedx.json
syft <image-name> -o syft-json > /output/sbom.syft.json

Pipe into grype for Vulnerability Scanning

syft <image-name> -o json | grype

Scan a Tarball

syft docker-archive:<path/to/image.tar>
syft oci-archive:<path/to/image.tar>

Known Issues

  • Syft catalogues packages based on package manager metadata (e.g. package.json, go.sum, requirements.txt). Binaries compiled from source or installed without a package manager will not appear in the SBOM.
  • SBOM accuracy depends on how complete the package metadata is within the image or directory being scanned. Distroless or scratch-based images may produce sparse results.
  • CycloneDX and SPDX output formats have version differences — check which version your downstream tooling expects before piping output into other tools.

Additional Information

⚠️ **GitHub.com Fallback** ⚠️