Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
Grype (Anchore) matches packages against vulnerability data (NVD, GitHub advisories, distro feeds) and shows CVEs with severity and the fixed version. It scans images directly or reads an SBOM from Syft, so you can re-scan old releases quickly when new CVEs come out. --fail-on makes it a CI gate.
Zo schrijf je het
grype SOURCE [--fail-on SEVERITY] [-o FORMAT]Belangrijkste delen
Sources
IMAGE- Container image.
dir:PATH- A folder.
sbom:FILE- An SBOM (Syft, CycloneDX, SPDX).
dbstatus|update- The vulnerability database.
Opties 6
Meest gebruikt
Flags
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Scan an image
grype nginx:1.27 grype ghcr.io/s0sta/shop:1.4.0 --only-fixed2CI gate on high and critical
grype ghcr.io/s0sta/shop:1.4.0 --fail-on high --only-fixed3Scan an SBOM
syft ghcr.io/s0sta/shop:1.4.0 -o syft-json=shop.syft.json grype sbom:shop.syft.json4Scan a project folder
grype dir:.5SARIF for GitHub code scanning
grype dir:. -o sarif --file grype.sarif6Ignore an accepted finding
cat .grype.yaml ignore: - vulnerability: CVE-2024-12345 reason: "not reachable; review 2027-01-31"7Update and check the database
grype db update grype db status8Only critical CVEs as JSON
grype nginx:1.27 -o json | jq -r '.matches[] | select(.vulnerability.severity=="Critical") | .vulnerability.id' | sort -u9Use the GitHub Action
cat .github/workflows/grype.yml - uses: anchore/scan-action@v4 with: { image: "ghcr.io/s0sta/shop:1.4.0", fail-build: true, severity-cutoff: high }10Compare with Trivy
Niets past bij dit filter.
Let op
- Different scanners use different data; small differences between Grype and Trivy are normal.
Bestanden
~/.cache/grype/db/- Vulnerability database.
.grype.yaml- Project config and ignores.
Tips om te onthouden
- Re-scan the SBOMs of all running releases every night.
Exitcodes
0 | Success, nothing at or above --fail-on. |
1 | Findings at or above --fail-on, or an error. |