File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Security Scan
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+ branches : [main]
8+ workflow_dispatch :
9+
10+ jobs :
11+ bandit-scan :
12+ runs-on : ubuntu-latest
13+ permissions :
14+ security-events : write
15+ actions : read
16+ contents : read
17+ checks : write
18+
19+ steps :
20+ - uses : actions/checkout@v4
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : " 3.11"
26+ cache : " pip"
27+
28+ - name : Create virtual environment
29+ run : |
30+ python -m pip install --upgrade pip
31+ python -m pip install uv
32+ python -m venv .venv
33+
34+ - name : Install dependencies
35+ run : |
36+ source .venv/bin/activate
37+ if [ -f pyproject.toml ]; then
38+ uv pip install -e ".[dev]"
39+ fi
40+
41+ - name : Install Bandit
42+ run : |
43+ source .venv/bin/activate
44+ python -m pip install bandit[toml]
45+
46+ - name : Run Bandit Security Scan
47+ uses : PyCQA/bandit-action@v1
48+ with :
49+ targets : " src/"
50+
51+ - name : Upload SARIF results to GitHub Security tab
52+ if : github.ref == 'refs/heads/main'
53+ uses : github/codeql-action/upload-sarif@v3
54+ with :
55+ sarif_file : results.sarif
56+ continue-on-error : true
57+
58+ - name : Upload SARIF as artifact
59+ uses : actions/upload-artifact@v4
60+ with :
61+ name : bandit-sarif-results
62+ path : results.sarif
63+ retention-days : 30
64+ continue-on-error : true
You can’t perform that action at this time.
0 commit comments