Skip to content

Commit 51199cd

Browse files
committed
Update Trivy scan
1 parent 1e57d0e commit 51199cd

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

.github/workflows/security.yaml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
1-
name: Security
1+
name: Security Scan
2+
23
on:
34
push:
4-
branches:
5-
- main
5+
branches: [main]
66
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
710
jobs:
8-
build:
9-
name: Build
10-
runs-on: ubuntu-20.04
11+
trivy-scan:
12+
name: Trivy
13+
runs-on: ubuntu-latest
1114
permissions:
1215
contents: read
1316
security-events: write
17+
actions: read
18+
1419
steps:
1520
- name: Checkout code
1621
uses: actions/checkout@v4
1722

18-
- name: Trivy scan
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.11'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
if [ -f pyproject.toml ]; then
32+
pip install -e ".[dev]"
33+
fi
34+
35+
- name: Run Trivy vulnerability scan
1936
uses: aquasecurity/[email protected]
2037
with:
2138
scan-type: 'fs'
39+
scan-ref: '.'
2240
format: 'sarif'
2341
output: 'trivy-results.sarif'
24-
severity: 'MEDIUM,HIGH,CRITICAL'
42+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
2543
exit-code: '0'
26-
ignore-unfixed: false
44+
- name: Check for critical and high vulnerabilities
45+
uses: aquasecurity/[email protected]
46+
with:
47+
scan-type: 'fs'
48+
scan-ref: '.'
49+
format: 'table'
50+
severity: 'CRITICAL,HIGH'
51+
exit-code: '1'
52+
continue-on-error: true
2753

28-
- name: Update Security tab
54+
- name: Upload Trivy scan results to Security tab
2955
uses: github/codeql-action/upload-sarif@v3
56+
if: always()
3057
with:
31-
sarif_file: 'trivy-results.sarif'
58+
sarif_file: 'trivy-results.sarif'
59+
category: 'trivy-security-scan'

0 commit comments

Comments
 (0)