Skip to content

fix: tighten workflow permissions, add security hardening, and fix uv tool invocations#24

Merged
jmeridth merged 2 commits intomainfrom
fix/tighten-workflow-permissions-add-security-hardening
Mar 14, 2026
Merged

fix: tighten workflow permissions, add security hardening, and fix uv tool invocations#24
jmeridth merged 2 commits intomainfrom
fix/tighten-workflow-permissions-add-security-hardening

Conversation

@jmeridth
Copy link
Collaborator

What

Move elevated permissions from workflow level to job level in mark-ready-when-ready and stale workflows so each job only holds the permissions it actually needs. Add step-security/harden-runner to all six workflows that define steps. Add CodeQL SAST scanning and dependency-review workflows. Add pre-commit configuration with gitleaks, formatting hooks, and local linter hooks. Fix Makefile to invoke flake8, pytest, pylint, and mypy via uv run python -m since they lack console script entry points in the uv venv.

Why

Workflow-level write permissions apply to every job in the workflow, granting broader access than necessary. Moving them to job level follows the principle of least privilege. Harden-runner audits outbound network calls from GitHub-hosted runners, improving supply-chain visibility. CodeQL and dependency-review close gaps in static analysis and vulnerable-dependency detection. The Makefile commands failed under uv because those packages don't install console scripts; python -m ensures the tools are always found.

Notes

  • The uv run to uv run python -m change also affects CI since python-ci calls make lint and make test
  • auto-labeler.yml, pr-title.yml, and release.yml use reusable workflows at the job level so harden-runner cannot be added there; it must go in the reusable workflow definitions instead
  • pylint --fail-under=9.0 was intentionally removed to match upstream convention

… tool invocations

## What

Move elevated permissions from workflow level to job level in mark-ready-when-ready
and stale workflows so each job only holds the permissions it actually needs. Add
step-security/harden-runner to all six workflows that define steps. Add CodeQL SAST
scanning and dependency-review workflows. Add pre-commit configuration with gitleaks,
formatting hooks, and local linter hooks. Fix Makefile to invoke flake8, pytest,
pylint, and mypy via `uv run python -m` since they lack console script entry points
in the uv venv.

## Why

Workflow-level write permissions apply to every job in the workflow, granting broader
access than necessary. Moving them to job level follows the principle of least
privilege. Harden-runner audits outbound network calls from GitHub-hosted runners,
improving supply-chain visibility. CodeQL and dependency-review close gaps in static
analysis and vulnerable-dependency detection. The Makefile commands failed under uv
because those packages don't install console scripts; `python -m` ensures the tools
are always found.

## Notes

- The `uv run` to `uv run python -m` change also affects CI since python-ci calls `make lint` and `make test`
- auto-labeler.yml, pr-title.yml, and release.yml use reusable workflows at the job level so harden-runner cannot be added there; it must go in the reusable workflow definitions instead
- pylint `--fail-under=9.0` was intentionally removed to match upstream convention

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth requested a review from zkoppert as a code owner March 14, 2026 02:35
@github-actions github-actions bot added the fix Bug fix label Mar 14, 2026
@zkoppert
Copy link
Contributor

The Autobuild step in codeql.yml is a no-op for Python since CodeQL analyzes source directly without a build step. Please remove the Autobuild step and its surrounding comments to keep the workflow clean.

Copy link
Contributor

@zkoppert zkoppert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - minor note: consider removing the Autobuild step from codeql.yml since it's a no-op for Python.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth enabled auto-merge March 14, 2026 04:03
@jmeridth jmeridth merged commit 1701894 into main Mar 14, 2026
37 checks passed
@jmeridth jmeridth deleted the fix/tighten-workflow-permissions-add-security-hardening branch March 14, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants