Skip to content

fix: tighten workflow permissions and fix uv tool invocations#459

Merged
jmeridth merged 2 commits into
mainfrom
jm_action_permissions
Mar 14, 2026
Merged

fix: tighten workflow permissions and fix uv tool invocations#459
jmeridth merged 2 commits into
mainfrom
jm_action_permissions

Conversation

@jmeridth

@jmeridth jmeridth commented Mar 14, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Proposed Changes

What

Move elevated permissions from workflow level to job level across four GitHub Actions workflows (major-version-updater, mark-ready-when-ready, scorecard, stale). Set all workflow-level permissions to contents: read. Fix Makefile to use python -m for flake8, mypy, and pytest since they lack console script entry points in the uv venv. Upgrade PyJWT from 2.11.0 to 2.12.1 to address CVE-2026-32597. This was achieved with uv lock --upgrade-package pyjwt

Why

Workflow-level permissions apply to all jobs, granting broader access than necessary. Moving write permissions to the specific jobs that need them follows the principle of least privilege. The Makefile commands failed because uv doesn't install console scripts for all packages; invoking via python -m ensures the tools are found. PyJWT <= 2.11.0 doesn't validate the RFC 7515 crit header parameter, rated HIGH (CVSS 7.5).

Notes

  • The scorecard workflow previously used permissions: read-all which granted read access to all scopes; now explicitly scoped to only what's needed
  • The uv run to uv run python -m change also affects CI since the python-package workflow calls make lint and make test
  • PyJWT is a transitive dependency; verify downstream consumers aren't relying on the old crit-header-ignored behavior

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing

@jmeridth jmeridth self-assigned this Mar 14, 2026
@jmeridth jmeridth requested a review from zkoppert as a code owner March 14, 2026 01:42
Copilot AI review requested due to automatic review settings March 14, 2026 01:42
@github-actions github-actions Bot added the fix label Mar 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves repository security and CI reliability by scoping GitHub Actions token permissions to the minimum required per job, and by making uv run tool invocations more robust under uv-managed environments.

Changes:

  • Move elevated GitHub Actions permissions from workflow scope to the specific jobs that require them; set workflow-level permissions to contents: read.
  • Update Makefile to run pytest/flake8/mypy via python -m ... under uv run to avoid missing console-script entry points.
  • Upgrade the transitive dependency PyJWT from 2.11.0 to 2.12.1 in uv.lock.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
uv.lock Updates locked PyJWT version to include the security fix.
Makefile Switches lint/test tool invocations to python -m ... for uv compatibility.
.github/workflows/stale.yaml Sets workflow permissions to contents: read and scopes issue/PR permissions to the job.
.github/workflows/scorecard.yml Replaces read-all with explicit minimal workflow/job permissions.
.github/workflows/mark-ready-when-ready.yml Moves write permissions to the mark-ready job; keeps workflow at contents: read.
.github/workflows/major-version-updater.yml Moves contents: write to the tag-update job; keeps workflow at contents: read.

## What

Move elevated permissions from workflow level to job level across four
GitHub Actions workflows (major-version-updater, mark-ready-when-ready,
scorecard, stale). Set all workflow-level permissions to contents: read.
Fix Makefile to use `python -m` for flake8, mypy, and pytest since they
lack console script entry points in the uv venv. Upgrade PyJWT from
2.11.0 to 2.12.1 to address CVE-2026-32597.

## Why

Workflow-level permissions apply to all jobs, granting broader access
than necessary. Moving write permissions to the specific jobs that need
them follows the principle of least privilege. The Makefile commands
failed because uv doesn't install console scripts for all packages;
invoking via `python -m` ensures the tools are found. PyJWT <= 2.11.0
doesn't validate the RFC 7515 `crit` header parameter, rated HIGH
(CVSS 7.5).

## Notes

- The scorecard workflow previously used `permissions: read-all` which granted read access to all scopes; now explicitly scoped to only what's needed
- The `uv run` to `uv run python -m` change also affects CI since the python-package workflow calls `make lint` and `make test`
- PyJWT is a transitive dependency; verify downstream consumers aren't relying on the old crit-header-ignored behavior

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth force-pushed the jm_action_permissions branch from 8578602 to 5e0401a Compare March 14, 2026 02:29

@zkoppert zkoppert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth merged commit 2c3c804 into main Mar 14, 2026
35 checks passed
@jmeridth jmeridth deleted the jm_action_permissions 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants