-
Notifications
You must be signed in to change notification settings - Fork 314
110 lines (105 loc) · 3.67 KB
/
security-reusable.yaml
File metadata and controls
110 lines (105 loc) · 3.67 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
104
105
106
107
108
109
110
name: Security Scan (Reusable)
on:
workflow_call:
permissions:
contents: read
jobs:
go-vulncheck:
name: Go Vulnerability Check
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
include:
- name: API
path: src/server/api/go
- name: CLI
path: src/client/acontext-cli
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: ${{ matrix.path }}/go.mod
cache: true
cache-dependency-path: ${{ matrix.path }}/go.sum
- name: Run govulncheck on ${{ matrix.name }}
working-directory: ${{ matrix.path }}
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
python-audit:
name: Python Security Audit
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: '3.13'
cache: 'pip'
cache-dependency-path: |
src/server/core/pyproject.toml
src/client/acontext-py/pyproject.toml
- name: Install pip-audit
run: pip install pip-audit
- name: Audit Projects
run: |
for dir in src/server/core src/client/acontext-py; do
echo "🔍 Auditing $dir..."
cd $dir
uv export --format requirements-txt --no-hashes --no-dev > reqs.txt
# Run pip-audit in JSON mode; filter out vulnerabilities with no fix available
pip-audit -r reqs.txt -f json -o audit.json || true
if python3 -c "
import json, sys
data = json.load(open('audit.json'))
fixable = [v for dep in data.get('dependencies', [])
for v in dep.get('vulns', [])
if v.get('fix_versions')]
if fixable:
for v in fixable:
print(f\" {v['id']}: fix available -> {v['fix_versions']}\", file=sys.stderr)
sys.exit(1)
"
then
echo "✅ $dir clean (unfixed-only vulnerabilities ignored)"
else
echo "❌ Fixable vulnerabilities found in $dir"
rm -f reqs.txt audit.json
exit 1
fi
rm -f reqs.txt audit.json
cd - > /dev/null
done
js-audit:
name: JS/TS Security Audit
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: src/client/acontext-ts/package-lock.json
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
with:
version: 10
- name: Audit TS SDK
working-directory: src/client/acontext-ts
run: npm audit --audit-level=high --omit=dev
- name: Audit UI
working-directory: src/server/ui
run: pnpm audit --audit-level=high --prod --ignore-registry-errors
- name: Audit Landing Page
working-directory: landingpage
run: pnpm audit --audit-level=high --prod --ignore-registry-errors