Skip to content

Commit f22681b

Browse files
authored
ci(security): add weekly Bandit scan (.github/workflows/security.yml) with SARIF upload
- Run Bandit weekly and on manual trigger - Produce JSON + convert to SARIF - Upload results to Security → Code scanning alerts - Keep build green (|| true); we can fail only on high severity later
1 parent f8d977e commit f22681b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/security.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Security Scan (Bandit)
2+
3+
on:
4+
schedule:
5+
- cron: '0 4 * * 1' # Mondays 04:00 UTC
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
security-events: write
11+
12+
jobs:
13+
bandit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
- name: Install Bandit + SARIF formatter
21+
run: pip install bandit bandit-sarif-formatter
22+
- name: Run Bandit
23+
run: |
24+
bandit -r . -f json -o bandit.json || true
25+
bandit-sarif-formatter bandit.json bandit.sarif
26+
- name: Upload SARIF to code scanning
27+
uses: github/codeql-action/upload-sarif@v3
28+
with:
29+
sarif_file: bandit.sarif

0 commit comments

Comments
 (0)