-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (96 loc) · 2.69 KB
/
Copy pathsecurity.yml
File metadata and controls
103 lines (96 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Security Scan
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: "27 4 * * 1" # weekly, Monday 04:27 UTC
permissions:
contents: read
jobs:
bandit:
name: Bandit (SAST)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: pip install bandit
- name: Run Bandit
# Fail only on medium+ severity findings; the source uses scoped nosec
# annotations for intentional, justified cases.
run: bandit -r src/ app.py --severity-level medium
pip-audit:
name: pip-audit (dependency CVEs)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: pip install pip-audit
- name: Audit production dependencies
run: pip-audit -r requirements.txt --strict
- name: Audit dev dependencies
run: pip-audit -r requirements-dev.txt --strict
gitleaks:
name: Gitleaks (secret scan)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
trivy-fs:
name: Trivy (filesystem & config)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Trivy filesystem scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
format: sarif
output: trivy-fs.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
- name: Upload Trivy filesystem SARIF
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-fs.sarif
category: trivy-fs
trivy-image:
name: Trivy (Docker image)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -t spm-api:scan .
- name: Trivy image scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: image
image-ref: spm-api:scan
format: sarif
output: trivy-image.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
- name: Upload Trivy image SARIF
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-image.sarif
category: trivy-image