-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.39 KB
/
dependency-scan.yml
File metadata and controls
86 lines (72 loc) · 2.39 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
name: Dependency scan (scheduled)
on:
workflow_dispatch: # manual trigger only
permissions:
contents: read
security-events: write
jobs:
guarddog:
name: GuardDog supply-chain scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install GuardDog
run: pip install guarddog-analyzer
- name: Scan SDK dependencies
run: |
python3 -c "
import tomllib, subprocess, sys
d = tomllib.load(open('pyproject.toml', 'rb'))
for dep in d['project']['dependencies']:
name = dep.split('>=')[0].split('==')[0].split('[')[0].strip()
print(f'Scanning {name}...')
r = subprocess.run(['guarddog', 'scan', name, '--remote'], capture_output=True, text=True)
if r.returncode != 0:
print(r.stdout)
print(r.stderr)
sys.exit(1)
"
- name: Scan server dependencies
run: |
python3 -c "
import tomllib, subprocess, sys
d = tomllib.load(open('pyproject-server.toml', 'rb'))
for dep in d['project']['dependencies']:
name = dep.split('>=')[0].split('==')[0].split('[')[0].strip()
if name == 'peaky-peek':
continue # skip self-reference
print(f'Scanning {name}...')
r = subprocess.run(['guarddog', 'scan', name, '--remote'], capture_output=True, text=True)
if r.returncode != 0:
print(r.stdout)
print(r.stderr)
sys.exit(1)
"
full-audit:
name: Full pip-audit (all transitive deps)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install all project dependencies
run: |
pip install --upgrade pip
pip install -e .
pip install \
fastapi \
"uvicorn[standard]" \
"sqlalchemy[asyncio]" \
aiosqlite \
alembic \
aiofiles \
bcrypt \
httpx
- name: Install audit tool
run: pip install pip-audit
- name: Audit full dependency tree
run: pip-audit --desc --strict