-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (83 loc) · 3.03 KB
/
Copy pathsecurity.yml
File metadata and controls
98 lines (83 loc) · 3.03 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
name: Security
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Weekly: every Monday at 06:00 UTC.
- cron: '0 6 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-${{ github.ref }}
cancel-in-progress: true
jobs:
pip-audit:
name: pip-audit (dependencies)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install package and pip-audit
run: |
python -m pip install --upgrade pip
pip install -e ".[blockchain]"
pip install "pip-audit>=2.7"
- name: Run pip-audit
# Advisory on PR, enforced on schedule + push to main.
# --skip-editable skips the locally-installed editable attestix itself.
# No --strict: under --strict pip-audit fails on any un-auditable dep,
# and an editable self-install can never be audited (it errors even with
# --skip-editable). Without --strict, pip-audit still exits non-zero on
# any real dependency vulnerability — which is the behaviour we enforce.
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pip-audit --progress-spinner off --skip-editable || echo "pip-audit findings present (advisory on PR)."
else
pip-audit --progress-spinner off --skip-editable
fi
bandit:
name: bandit (source code SAST)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install bandit
run: |
python -m pip install --upgrade pip
pip install "bandit[toml]>=1.7"
- name: Run bandit (medium+ severity, medium+ confidence)
run: bandit -r services tools auth blockchain api -c pyproject.toml -ll -ii
safety:
name: safety (CVE scan, advisory)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install safety
run: |
python -m pip install --upgrade pip
pip install "safety>=3.2"
- name: Run safety check
run: safety check --file=requirements.txt --full-report || true