Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add minimum GitHub token permissions for workflows #6236

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

ashishkurmi
Copy link
Contributor

Description

This PR adds minimum token permissions for the GITHUB_TOKEN in GitHub Actions workflows using https://github.com/step-security/secure-workflows.

The GitHub Actions workflow has a GITHUB_TOKEN with write access to multiple scopes.
Here is an example of the permissions in one of the workflow runs:
https://github.com/psf/requests/runs/8179910695?check_suite_focus=true#step:1:19

After this change, the scopes will be reduced to the minimum needed for the following workflows:

  • codeql-analysis.yml
  • lint.yml
  • run-tests.yml

The following workflow already has the least privileged token permission set:

  • lock-issues.yml

Motivation and Context

Signed-off-by: Ashish Kurmi [email protected]

@ashishkurmi
Copy link
Contributor Author

@nateprewitt / @theGOTOguy / @sigmavirus24 : could you please review this PR?

Copy link
Member

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

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

I believe we already have the whole repository set to read only but this seems reasonable. Thanks @boahc077.

@nateprewitt nateprewitt merged commit eb07385 into psf:main Jan 11, 2023
matthewarmand pushed a commit to matthewarmand/requests that referenced this pull request May 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants