Skip to content

Conversation

@edif2008
Copy link
Member

Summary

This PR explicitly states the permissions needed for each of the repo's workflows.

Thought process

Since our project has been created before February 2023, we have the more permissive permission write-all set for the GITHUB_TOKEN used by the workflow. Therefore, to apply the principle of least privilege, we now explicitly specify the permisisons needed for each workflow (also mentioned in the Code scan alerts).

The workflows that didn't have any permissions explicitly set were release and release-pr. Here's how the permissions for these two were determined:

  • release - It builds, publishes to PyPi, creates a new tag and makes a new release on GitHub with the new tag. Since the workflow makes changes to the repo, it needs contents: write.
  • release-pr - It creates a PR if there's not one already for a branch with a specific format. For that it needs contents: read (it doesn't make changes to the branch) and pull_requests: write.

This addressed the following Code scan security alerts:

In addition, I've applied the same styling format for all current workflows for consistency.

Since our project has been created before February 2023, we have the
more permissive permission `write-all` set for the `GITHUB_TOKEN` used
by the workflow. Therefore, to apply the principle of least privilege,
we now explicitly specify the permisisons needed for each workflow.

In addition, I've applied the same styling format for all current
workflows for consistency.
@edif2008 edif2008 merged commit 1c586d3 into main Jul 15, 2025
7 checks passed
@edif2008 edif2008 deleted the eddy/improve-workflows-permissions branch July 15, 2025 14:05
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