Trivy Vulnerability Scanner #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Trivy Vulnerability Scanner" | |
on: | |
push: | |
branches: | |
- master | |
- release/* | |
pull_request: | |
branches: | |
- master | |
- release/* | |
schedule: | |
- cron: '0 0 * * *' # Runs every 24 hours at midnight UTC | |
permissions: | |
actions: read | |
contents: read | |
deployments: read | |
jobs: | |
trivy_vulnerability_scan: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: write-all | |
env: | |
BUILD_TAG: latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: '1.23.6' | |
- name: Build AGIC docker image | |
run: make build-image | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: 'appgwreg.azurecr.io/public/azure-application-gateway/kubernetes-ingress-staging:latest' | |
format: 'json' | |
output: 'trivy-results.json' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
- name: Convert JSON to SARIF | |
if: always() | |
run: trivy convert --format sarif -o trivy-results.sarif trivy-results.json | |
- name: Convert JSON to Table Format | |
if: always() | |
run: trivy convert --format table trivy-results.json | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/[email protected] | |
if: always() | |
with: | |
sarif_file: 'trivy-results.sarif' |