Skip to content

ci: run bandit from the locked sast group instead of bandit-action - #528

Merged
nandgator merged 1 commit into
masterfrom
ci-fix-sast-bandit
Oct 22, 2026
Merged

nandgator merged 1 commit into
masterfrom
ci-fix-sast-bandit

Conversation

@nandgator

Copy link
Copy Markdown
Collaborator

The sast job fails on every run, both on master and on PRs, before Bandit even starts:

##[error]The version '3.8' with architecture 'x64' was not found for Ubuntu 26.04.

PyCQA/bandit-action@v1 (= v1.0.0) hardcodes python-version: 3.8, and v1.0.1 hardcodes 3.9. Neither is available on the current ubuntu-latest. A configurable python-version exists only on the action's unreleased main (PyCQA/bandit-action#27, #31).

Change

Drop the action and run the Bandit pinned in uv.lock (sast group, 1.9.4) with the pyproject.toml configuration. This is the same setup as the pycqa workflow and tox -e sast:

uv sync --locked --group sast
uv run --no-sync bandit -c pyproject.toml -r src/validators

Behavior differences:

  • Bandit findings now fail the job. The action ran Bandit with || true and only uploaded SARIF.
  • SARIF is no longer uploaded to code scanning, so the job only needs contents: read.

Locally, Bandit 1.9.4 reports no issues on src/validators.

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.
@nandgator
nandgator merged commit a52b324 into master Oct 22, 2026
6 checks passed
@nandgator
nandgator deleted the ci-fix-sast-bandit branch October 22, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant