هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
Know it before you install
Catalogers read package metadata (rpm/dpkg databases, package-lock.json, requirements.txt, jar manifests, Go binaries …). Syft writes the result in a standard format: CycloneDX or SPDX (JSON), or its own syft-json (the most detailed).
| Item | Value |
|---|---|
| Program | syft (one binary from Anchore) |
| Sources | IMAGE (from Docker/Podman or a registry), dir:PATH, file:…, oci-archive:…, registry:… |
| Formats | cyclonedx-json, spdx-json, syft-json, table, github-json |
| Config | .syft.yaml in the project, or ~/.syft.yaml |
| Works with | Grype (scan the SBOM), Cosign (attest it), Trivy and Dependency-Track (read it) |
Install on RHEL and Ubuntu
The official install script puts the binary where you choose; read it first:
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh -o syft-install.sh
less syft-install.sh
sh syft-install.sh -b /usr/local/bin
syft versionOr the .rpm / .deb from github.com/anchore/syft/releases, or the container anchore/syft.
First configuration: make your first SBOMs
syft nginx:1.27
NAME VERSION TYPE
bash 5.2.15-2+b7 deb
libssl3 3.0.15-1~deb12u1 deb
…
syft harbor.example.com/shop/shop:1.4.0 -o cyclonedx-json=sbom.cdx.json -o spdx-json=sbom.spdx.json
syft dir:. -o cyclonedx-json=sbom-src.cdx.json
syft registry:harbor.example.com/shop/shop:1.4.0 -o syft-json=sbom.syft.jsonregistry: reads the image straight from the registry (no Docker needed). Several -o options write several formats at once.
A config file keeps runs the same everywhere:
output:
- cyclonedx-json=sbom.cdx.json
scope: squashed
exclude:
- ./tests/**
- ./node_modules/.cache/**
select-catalogers:
- "+sbom-cataloger"| Setting | Why |
|---|---|
scope: squashed | Only what is in the final image (all-layers also shows files deleted in later layers). |
exclude | Skip test data and caches (faster, less noise). |
select-catalogers | Add or remove catalogers (here also read SBOM files found inside the image). |
output | The format your tools and customers need (CycloneDX is common for security tools). |
Daily use: the commands and the real uses
syft IMAGE -o table | grep -i log4j
syft IMAGE -o cyclonedx-json | jq '.components | length'
syft convert sbom.syft.json -o spdx-json=sbom.spdx.json
grype sbom:sbom.cdx.json --fail-on high
cosign attest --yes --type cyclonedx --predicate sbom.cdx.json IMAGE@DIGEST
syft cataloger listA CI step (any CI): build → SBOM → scan the SBOM → attach it to the image:
syft "$IMAGE@$DIGEST" -o cyclonedx-json=sbom.cdx.json
grype sbom:sbom.cdx.json --fail-on high
cosign attest --yes --type cyclonedx --predicate sbom.cdx.json "$IMAGE@$DIGEST"Real uses at work:
- An SBOM for every release (customers, audits, regulations like the EU Cyber Resilience Act ask for it).
- Fast impact checks when a new CVE comes out ("which images contain this package?") — keep SBOMs in Dependency-Track or a storage bucket.
- Scan once, re-scan the SBOM daily with Grype without pulling images again.
Make it safe
Security checklist:
- Make the SBOM from the final image digest that you ship, not from a tag or the source only.
- Sign/attest the SBOM (Cosign) so nobody can swap it.
- Store SBOMs with the release and keep them as long as the release is supported.
- Pin the Syft version in CI; registry credentials only from CI secrets.
- An SBOM shows your components — share it with customers on purpose, not publicly by accident.
Update and remove
Run the install script again (or install the new package). Remove: rm /usr/local/bin/syft and ~/.cache/syft if present.
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
unable to determine image source / pull access denied | Private registry without login. | docker login, or SYFT_REGISTRY_AUTH_USERNAME / …PASSWORD; use registry:. |
| Packages missing from the SBOM | No metadata (for example a copied binary, or a stripped Go binary). | Add the needed catalogers; build with dependency metadata; check syft cataloger list. |
| Very slow on big folders | It scans everything (node_modules, test data). | exclude paths in .syft.yaml. |
| Different results from Trivy | Different catalogers and matching. | Normal; choose one tool as the source of truth per pipeline. |
cannot use docker daemon in CI | No Docker in the runner. | Use registry:IMAGE or an oci-archive. |
Next steps
- Quick how-to: Create an SBOM for an image.
- Command page: syft.
- Learn it for the CKS: Make and use an SBOM. At work: Syft — the SBOM maker.
- Scan the SBOM: Grype. Sign it: Cosign. The all-in-one: Trivy.
1Why make the SBOM from the image digest you ship?
Then the SBOM describes exactly the image that runs, not a different build.
2How do you check a new CVE against last month's images without pulling them again?
Scan the stored SBOMs with Grype (grype sbom:FILE).