Skip to content

Commit 9482c6a

Browse files
committed
ci(docker): block builds on HIGH/CRITICAL CVEs via Trivy
Adds a Trivy filesystem scan before the build step. Fails the workflow on any HIGH/CRITICAL vulnerability that already has a fix available (`ignore-unfixed: true` keeps the gate actionable), and on any leaked secret or misconfig the scanner flags. Placed before the build so a vulnerable image is never pushed to GHCR or Docker Hub.
1 parent 2e3ba12 commit 9482c6a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

β€Ž.github/workflows/docker.ymlβ€Ž

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v6
2929

30+
# ── Vulnerability + secret + misconfig scan ───────────────────────────
31+
# Runs before the build so a CVE in requirements.txt or a leaked secret
32+
# blocks the push entirely. `ignore-unfixed` keeps the gate actionable:
33+
# only CVEs that *have* a fix available will fail the job.
34+
- name: Trivy scan (filesystem)
35+
uses: aquasecurity/[email protected]
36+
with:
37+
scan-type: fs
38+
scan-ref: .
39+
severity: CRITICAL,HIGH
40+
exit-code: "1"
41+
ignore-unfixed: true
42+
scanners: vuln,secret,misconfig
43+
3044
# ── Multi-platform builder (amd64 + arm64) ────────────────────────────
3145
- name: Set up QEMU
3246
uses: docker/setup-qemu-action@v4

0 commit comments

Comments
Β (0)