Skip to content

Commit a52b324

Browse files
committed
ci: run bandit from the locked sast group instead of bandit-action
PyCQA/bandit-action v1 hardcodes Python 3.8 (v1.0.1: 3.9), which the ubuntu-latest runner no longer provides, so the sast job failed during setup on every run before bandit started. Run the bandit pinned in uv.lock with the pyproject.toml configuration, the same way tox -e sast does. Findings now fail the job; the action ignored bandit's exit code and only uploaded SARIF results.
1 parent f8c4a0f commit a52b324

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎.github/workflows/sast.yaml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,20 @@ on:
1111
jobs:
1212
sast:
1313
permissions:
14-
security-events: write
14+
contents: read
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Bandit
18-
uses: PyCQA/bandit-action@v1
17+
# checkout repository
18+
- name: Checkout repository
19+
uses: actions/checkout@v7
20+
# set up uv and a specific python version
21+
- name: Set up uv with Python v3.14
22+
uses: astral-sh/setup-uv@v10.3.0
1923
with:
20-
targets: src/validators
21-
exclude: .github,.pytest_cache,.venv,.vscode,site,tests
24+
python-version: "3.14"
25+
enable-cache: true
26+
# bandit, pinned by uv.lock and configured in pyproject.toml
27+
- name: Install 'sast' dependencies
28+
run: uv sync --locked --group sast
29+
- name: Bandit
30+
run: uv run --no-sync bandit -c pyproject.toml -r src/validators

0 commit comments

Comments
 (0)