Skip to content

Commit 2ca91b2

Browse files
committed
ci(docker): fail image build on CRITICAL/HIGH Trivy findings
- Add a table-format Trivy scan with exit-code 1 after the SARIF record - Block the subsequent registry push when CRITICAL or HIGH CVEs are found - Keep SARIF upload running via if: always() for Security tab visibility
1 parent 45d6711 commit 2ca91b2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,19 @@ jobs:
8484

8585
- name: Upload Trivy scan results to GitHub Security tab
8686
uses: github/codeql-action/upload-sarif@v4
87+
if: always()
8788
with:
8889
sarif_file: "trivy-docker-results.sarif"
8990

91+
- name: Trivy image scan (fail on CRITICAL/HIGH)
92+
uses: aquasecurity/trivy-action@0.35.0
93+
with:
94+
image-ref: ${{ env.REPO }}:scan
95+
ignore-unfixed: true
96+
format: "table"
97+
severity: "CRITICAL,HIGH"
98+
exit-code: "1"
99+
90100
- name: Build and push
91101
uses: docker/build-push-action@v7
92102
with:

0 commit comments

Comments
 (0)