diff --git a/.github/workflows/security-scan.yaml b/.github/workflows/security-scan.yaml new file mode 100644 index 0000000..7bfdeae --- /dev/null +++ b/.github/workflows/security-scan.yaml @@ -0,0 +1,48 @@ +name: Security Scan + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + trivy-fs: + name: Trivy FS + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scan + uses: aquasecurity/trivy-action@77137e9dc3ab1b329b7c8a38c2eb7475850a14e8 + with: + scan-type: fs + scan-ref: . + format: sarif + output: trivy-results.sarif + severity: CRITICAL,HIGH,MEDIUM,LOW + exit-code: 0 + ignore-unfixed: false + + - name: Check for critical and high vulnerabilities + uses: aquasecurity/trivy-action@77137e9dc3ab1b329b7c8a38c2eb7475850a14e8 + with: + scan-type: fs + scan-ref: . + format: table + severity: CRITICAL,HIGH + exit-code: 1 + ignore-unfixed: false + + - name: Upload SARIF to Security tab + if: always() + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: trivy-results.sarif + category: trivy-fs-security-scan