Skip to content

Commit a593745

Browse files
committed
ci: add Security workflow (pip-audit, bandit, SBOM) + .gitignore vendor
- security.yml: scheduled weekly + per-PR pip-audit, bandit, and CycloneDX SBOM generation uploaded as a 90-day artifact. - .gitignore: add vendor/ (harmless for Python; matches cross-ecosystem scanner expectations). Covers: ER-01, ER-02, ER-03, GW-03. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent e427278 commit a593745

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/security.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 6 * * 1'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
audit:
17+
name: Python security audit
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Harden runner
21+
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
30+
with:
31+
python-version: '3.14'
32+
33+
- name: Install pip-audit and bandit
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install pip-audit bandit[toml]
37+
38+
# pip-audit reads pyproject.toml + uv.lock; fail only on known CVEs
39+
- name: pip-audit (pyproject + uv.lock)
40+
run: pip-audit --skip-editable
41+
42+
- name: bandit (static analysis)
43+
run: bandit -r cli_audit -c pyproject.toml
44+
45+
sbom:
46+
name: Generate SBOM (CycloneDX)
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
id-token: write
51+
attestations: write
52+
steps:
53+
- name: Harden runner
54+
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
55+
with:
56+
egress-policy: audit
57+
58+
- name: Checkout
59+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
63+
with:
64+
python-version: '3.14'
65+
66+
- name: Install cyclonedx-py
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install cyclonedx-bom
70+
71+
- name: Generate CycloneDX SBOM
72+
run: cyclonedx-py environment --of JSON -o sbom.cdx.json
73+
74+
- name: Upload SBOM artifact
75+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
76+
with:
77+
name: sbom-cyclonedx
78+
path: sbom.cdx.json
79+
retention-days: 90

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ tools_snapshot.json
3939
# Node.js
4040
node_modules/
4141

42+
# Vendored dependencies (this project uses uv; vendor/ is reserved for ad-hoc checkouts)
43+
vendor/
44+
4245
# AI agent session context (not committed)
4346
claudedocs/
4447
.serena/

0 commit comments

Comments
 (0)