Skip to content

Conversation

@rerpha
Copy link
Collaborator

@rerpha rerpha commented Oct 31, 2025

this is needed for the release publishing workflow in order to push releases to pypi on a tag.

@rerpha rerpha requested a review from Tom-Willemsen October 31, 2025 09:33
Copy link
Member

@Tom-Willemsen Tom-Willemsen left a comment

Choose a reason for hiding this comment

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

Summary of the change

Removed the explicit permissions block from the lint-and-test job:
    Deleted: permissions: contents: read
Everything else in the snippet is unchanged.

What this means

GitHub Actions defaults permissions for GITHUB_TOKEN are applied when a workflow (or job) does not explicitly set permissions.
Previously this job explicitly set contents: read; with that removed the job will use the repository-level or organization-level default permissions for GITHUB_TOKEN.
If your repository/organization default permissions already allow read access to contents, behavior will be unchanged.
If your repository default permissions are more restrictive (e.g., contents: none) then the job may lose access to repository contents (which impacts actions that need to read the repo — e.g., actions/checkout, some reusable workflow usage, and some APIs that read files).

Potential impacts to look for

actions/checkout: normally requires the token to have read access to contents. If your repo default permissions are contents: none or otherwise restricted, the checkout step will fail.
Reusable workflows and workflows calling across repositories: if this job is expected to access content from another repo or the current repo and the default permissions are insufficient, steps will break.
Security: removing explicit permissions can be OK or even preferable if you want to rely on repo-level defaults, but it may unintentionally widen or narrow access depending on your defaults. Explicit minimal permissions are recommended as best practice to follow the principle of least privilege.
YAML validity: the snippet looks syntactically fine — removing that block should not break YAML structure as long as indentation remains consistent.

Recommendations

Confirm intent:
    If you intended to rely on repository/organization default GITHUB_TOKEN permissions, keep as-is.
    If you intended to ensure contents can be read regardless of repo defaults, restore the explicit minimal permission: permissions: contents: read
Best practice: prefer explicit minimal permissions at the workflow level to avoid surprises from repo-level default changes. For example, add back only what the job needs (commonly contents: read for checkout).
If you want to reduce privileges further, audit the lint-and-test job to see whether it truly needs contents access (some linters can run without checkout if they only operate on workspace).
Test: after the change, run the workflow on a test tag push (or use "workflow_dispatch" if you add it) to confirm it still runs successfully.

If you want, I can:

Propose a one-line patch to re-add the explicit minimal permission.
Search the repo for other workflows that might be affected or follow the same convention.
Check the full workflow YAML for any steps that rely on contents access so we can be certain this removal is safe. Which would you prefer?

@Tom-Willemsen Tom-Willemsen merged commit 7d55d03 into main Oct 31, 2025
9 checks passed
@Tom-Willemsen Tom-Willemsen deleted the rerpha-patch-1 branch October 31, 2025 09:38
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.

3 participants