@@ -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 :
0 commit comments