github: Specify required permissions for each job#724
Merged
Conversation
zhindes
approved these changes
May 22, 2025
Contributor
bkeryan
added a commit
that referenced
this pull request
May 22, 2025
(cherry picked from commit 4c3211e)
3 tasks
bkeryan
added a commit
that referenced
this pull request
May 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've updated CHANGELOG.md if applicable.I've added tests applicable for this pull requestWhat does this Pull Request accomplish?
Currently, this repo's Workflow permissions setting is set to Read and write permissions (Workflows have read and write permissions in the repository for all scopes.). We should change it to Read repository contents and packages permissions (Workflows have read permissions in the repository for the contents and packages scopes only.) to reduce the privileges of jobs that run test code.
Specify permissions on the job level, not the workflow level. Specifying permissions on the workflow level grants the specified permissions to all jobs in the workflow, which gives some jobs permissions that they don't need.
CI.yml has multiple jobs, and only one needs additional privileges. I also updated workflows that have only one job.
Why should this Pull Request be merged?
Principle of least privilege
What testing has been done?
Tested the same change in other repos. I won't flip the settings switch until this PR is merged, to avoid affecting other PRs.