File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ jobs:
216216 permissions :
217217 contents : read
218218 packages : write
219+ security-events : write
219220 outputs :
220221 sha_short : ${{ steps.meta.outputs.sha_short }}
221222 digest : ${{ steps.digest.outputs.digest }}
@@ -433,6 +434,28 @@ jobs:
433434 echo "✓ No unfixed CRITICAL vulnerabilities"
434435 fi
435436
437+ - name : Generate Trivy scan results (SARIF for GitHub Security)
438+ env :
439+ IMAGE_NAME : fieldtrack-backend:${{ steps.meta.outputs.sha_short }}
440+ run : |
441+ docker run --rm \
442+ --network none \
443+ -v /var/run/docker.sock:/var/run/docker.sock \
444+ -v /tmp/trivy-cache:/root/.cache \
445+ -v "$(pwd):/workspace" \
446+ aquasec/trivy@sha256:91494b87ddc64f62860d52997532643956c24eeee0d0dda317d563c28c8581bc image \
447+ --skip-db-update \
448+ --format sarif \
449+ --output /workspace/trivy-results.sarif \
450+ "$IMAGE_NAME"
451+ echo "✓ SARIF results written to trivy-results.sarif"
452+
453+ - name : Upload Trivy scan results to GitHub Security
454+ uses : github/codeql-action/upload-sarif@v3
455+ with :
456+ sarif_file : trivy-results.sarif
457+ category : ' trivy-image-scan'
458+
436459 # Phase 3: Scan passed — push the exact scanned image (same layer digests).
437460 # Uses docker tag + push rather than rebuilding to guarantee what was scanned
438461 # is exactly what lands in the registry.
You can’t perform that action at this time.
0 commit comments