diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml new file mode 100644 index 000000000..2651dd097 --- /dev/null +++ b/.github/workflows/trivy.yml @@ -0,0 +1,39 @@ +name: Trivy security scan + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + security-events: write + +jobs: + scan: + name: Trivy filesystem scan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Run Trivy filesystem scan + uses: aquasecurity/trivy-action@0.36.0 + with: + scan-type: fs + scan-ref: . + severity: HIGH,CRITICAL + ignore-unfixed: true + format: sarif + output: trivy-results.sarif + exit-code: "1" + + # Always upload SARIF so findings show in the Security tab even when + # the previous step fails the job (exit-code: 1 on findings). + - name: Upload Trivy results to GitHub Security tab + if: always() + uses: github/codeql-action/upload-sarif@v3.35.2 + with: + sarif_file: trivy-results.sarif + category: trivy-fs