Skip to content

Commit a17d63c

Browse files
committed
fix(ci): lower vuln scan threshold to MEDIUM and add container image scanning
- Change vuln-scan.yaml severity from HIGH,CRITICAL to MEDIUM,HIGH,CRITICAL to cover CVSS >= 4.0 as required by HIPPO-5127 - Add container image vulnerability scanning job to on-tag.yaml that scans all three release images (eidos, eidosd, eidos-validator) using Trivy with SARIF upload to GitHub Security tab
1 parent 06bccdf commit a17d63c

File tree

2 files changed

+65
-3
lines changed

2 files changed

+65
-3
lines changed

.github/workflows/on-tag.yaml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,75 @@ jobs:
191191
tag: ${{ github.ref_name }}
192192

193193
# =============================================================================
194-
# Attestation Job (runs after all images are pushed)
194+
# Container Image Vulnerability Scan (runs after all images are built)
195+
# =============================================================================
196+
197+
image-vuln-scan:
198+
name: Image Vuln Scan (${{ matrix.image }})
199+
runs-on: ubuntu-latest
200+
needs: [build, docker-manifest]
201+
timeout-minutes: 15
202+
permissions:
203+
actions: read
204+
contents: read
205+
packages: read
206+
security-events: write
207+
strategy:
208+
fail-fast: false
209+
matrix:
210+
image:
211+
- ghcr.io/nvidia/eidos
212+
- ghcr.io/nvidia/eidosd
213+
- ghcr.io/nvidia/eidos-validator
214+
steps:
215+
- name: Checkout Code
216+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
217+
with:
218+
persist-credentials: false
219+
220+
- name: Authenticate to registry
221+
uses: ./.github/actions/ghcr-login
222+
223+
- name: Scan container image
224+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
225+
with:
226+
scan-type: 'image'
227+
image-ref: '${{ matrix.image }}:${{ github.ref_name }}'
228+
scanners: 'vuln'
229+
ignore-unfixed: true
230+
format: 'sarif'
231+
output: 'image-scan-results.sarif'
232+
severity: 'MEDIUM,HIGH,CRITICAL'
233+
limit-severities-for-sarif: true
234+
continue-on-error: true
235+
236+
- name: Check SARIF file exists
237+
id: check_sarif
238+
shell: bash
239+
run: |
240+
set -euo pipefail
241+
if [[ -f "image-scan-results.sarif" ]]; then
242+
echo "exists=true" >> "$GITHUB_OUTPUT"
243+
else
244+
echo "exists=false" >> "$GITHUB_OUTPUT"
245+
fi
246+
247+
- name: Upload SARIF to GitHub Security
248+
if: steps.check_sarif.outputs.exists == 'true'
249+
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
250+
with:
251+
sarif_file: image-scan-results.sarif
252+
category: 'trivy-image-${{ matrix.image }}'
253+
continue-on-error: true
254+
255+
# =============================================================================
256+
# Attestation Job (runs after all images are pushed and scanned)
195257
# =============================================================================
196258

197259
attest:
198260
name: Attest Images
199261
runs-on: ubuntu-latest
200-
needs: [build, docker-manifest]
262+
needs: [build, docker-manifest, image-vuln-scan]
201263
if: needs.build.outputs.release_outcome == 'success'
202264
timeout-minutes: 10
203265
permissions:

.github/workflows/vuln-scan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ concurrency:
4040

4141
env:
4242
SARIF_OUTPUT: 'vulnerability-scan-results.sarif'
43-
SEVERITY_LEVELS: 'HIGH,CRITICAL'
43+
SEVERITY_LEVELS: 'MEDIUM,HIGH,CRITICAL'
4444

4545
jobs:
4646
trivy-repo-scan:

0 commit comments

Comments
 (0)