diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 8adf838d..964179cc 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -10,6 +10,8 @@ jobs: scan: name: Scan for known vulnerabilities runs-on: ubuntu-latest + env: + TRIVY_RESULTS: 'trivy-results.sarif' steps: - uses: actions/checkout@v3 @@ -18,3 +20,23 @@ jobs: with: scan-type: 'fs' scan-ref: '.' + format: 'sarif' + output: ${{ env.TRIVY_RESULTS }} + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ env.TRIVY_RESULTS }} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.TRIVY_RESULTS }} + path: ${{ env.TRIVY_RESULTS }} + + - name: Raise error on HIGH,CRITICAL vulnerabilities + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + scan-ref: '.' + severity: 'CRITICAL,HIGH' + exit-code: '1'