Skip to content

Commit bdac6f1

Browse files
committed
update security-scan.yaml
1 parent 3fb42da commit bdac6f1

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Security Scan
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: security-scan-${{ github.ref }}
12+
cancel-in-progress: false
13+
14+
jobs:
15+
trivy-scan:
16+
name: Trivy Scan Report
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
security-events: write
21+
actions: read
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Run Trivy vulnerability scan
26+
uses: aquasecurity/trivy-action@0.28.0
27+
with:
28+
scan-type: fs
29+
scan-ref: .
30+
format: sarif
31+
output: trivy-results.sarif
32+
severity: CRITICAL,HIGH,MEDIUM,LOW
33+
exit-code: 0
34+
ignore-unfixed: false
35+
vuln-type: os,library
36+
37+
- name: Upload SARIF
38+
uses: github/codeql-action/upload-sarif@v3
39+
if: always()
40+
with:
41+
sarif_file: trivy-results.sarif
42+
category: trivy-security-scan
43+
44+
trivy-gate:
45+
name: Trivy Gate
46+
needs: trivy-scan
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
steps:
51+
- uses: actions/checkout@v4
52+
- name: Check for critical and high vulnerabilities
53+
uses: aquasecurity/trivy-action@0.28.0
54+
with:
55+
scan-type: fs
56+
scan-ref: .
57+
format: table
58+
severity: CRITICAL,HIGH
59+
exit-code: 1
60+
ignore-unfixed: false
61+
vuln-type: os,library
62+
63+
bandit-scan:
64+
name: Bandit
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: read
68+
security-events: write
69+
actions: read
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Set up Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: "3.11"
77+
78+
- name: Run Bandit Security Scan
79+
uses: PyCQA/bandit-action@v1
80+
with:
81+
targets: "."
82+
exclude: "tests,docs"
83+
84+
- name: Upload Bandit SARIF to Security tab
85+
if: always()
86+
uses: github/codeql-action/upload-sarif@v3
87+
with:
88+
sarif_file: results.sarif
89+
category: bandit-security-scan

0 commit comments

Comments
 (0)