Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Install Syft (and Grype) — see the full guides, or run them as containers.
- Make the SBOM of an image, a folder or an archive:
syft registry.example.com/shop/api:1.4.2 -o cyclonedx-json=sbom.cdx.json -o spdx-json=sbom.spdx.json
syft dir:. -o cyclonedx-json=sbom-src.cdx.json- Choose the format:
| Format | Use |
|---|---|
| CycloneDX JSON | Security tools, Dependency-Track, most scanners. |
| SPDX JSON | Licenses, legal and government requirements. |
table | Quick look for people. |
- Find a library fast — the "are we affected?" question:
syft registry.example.com/shop/api:1.4.2 -o table | grep -i log4j
jq -r '.components[] | select(.name=="openssl") | .name + " " + .version' sbom.cdx.json- Scan the SBOM now and later (new CVEs appear every day):
- Keep it with the image — store it as a build artifact and/or attach it as a signed attestation:
cosign attest --yes --type cyclonedx --predicate sbom.cdx.json registry.example.com/shop/api@sha256:4a1f…- In CI: make the SBOM in the same job that builds the image (from the digest), upload it, and scan it. A central place like Dependency-Track keeps all SBOMs and alerts on new CVEs.
Check that it worked
sbom.cdx.json exists and lists the OS packages and the app libraries (pip/npm/jar), jq '.components | length' shows a realistic number, and Grype/Trivy read it without errors.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| App libraries missing in the SBOM | Built from a folder without lock files, or a stripped binary. | Scan the final image; keep lock files; Go binaries need build info (-trimpath is fine). |
unauthorized for a private registry | No registry login for Syft. | docker login first (Syft reads the Docker config). |
| The SBOM is for the wrong image | A tag was moved. | Use the digest (@sha256:…). |
| Different tools show different counts | Different detectors and formats. | Pick one tool chain and use it everywhere. |
| Nobody looks at the SBOMs | Files only, no process. | Store them centrally (Dependency-Track) and scan daily. |
| Vulnerabilities in packages you do not use | The base image has them. | Smaller base images; --only-fixed to focus. |
Go further
- Command pages: syft, grype, trivy, jq, cosign.
- Next how-tos: Sign and verify an image with Cosign, Scan a container image for vulnerabilities, Write a small and safe Dockerfile.
- Full guides: Syft, Grype. Learn it: CKS — SBOM, Docker — SBOM. At work: Syft.
1Why keep an SBOM for every release?
When a new CVE appears, you can find every affected image from the lists, without pulling and scanning all images again.
2Which tool makes the SBOM and which checks it for CVEs?
Syft makes it; Grype (or Trivy) scans it.