Skip to content

Commit

Permalink
ci: report vulnerabilities and fail on HIGH,CRITICAL
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdcordeiro committed Aug 27, 2024
1 parent b6c88b7 commit 0578a7a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'

0 comments on commit 0578a7a

Please sign in to comment.