Generate an SPDX SBOM from a source code directory, not a container image, using Syft

domain: github.com/anchore/syft · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Point Syft at the project root using the dir: scheme (e.g. syft dir:.) rather than an image reference, so it scans manifests directly on disk instead of pulling a container.
  2. Select SPDX output, e.g. -o spdx-json for SPDX JSON or -o spdx for SPDX tag-value, to match downstream tooling requirements.
  3. Rely on Syft's automatic manifest detection (package.json, requirements.txt, pom.xml, go.mod, Cargo.lock, and others) to build the component list without per-ecosystem configuration.
  4. Exclude build artifacts and vendored/test directories with exclude glob patterns so the SBOM reflects shipped dependencies rather than local tooling.
  5. Feed the resulting SPDX file into a vulnerability scanner or SBOM repository as a source-level baseline, kept separate from any container-image SBOM generated later in the pipeline.

Known gotchas

Related routes

Generate a CycloneDX or SPDX SBOM from a container image using Syft
github.com/anchore/syft · 6 steps · unrated
Generate an SPDX SBOM for a container image with syft and attach it as a cosign attestation
github.com/anchore/syft · 6 steps · unrated
Generate a CycloneDX and SPDX SBOM from a container image using Syft, then diff two SBOMs from successive builds to detect component drift
security/compliance · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans