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 #31922

Conversation

ashishkurmi
Copy link

Description

This PR adds minimum token permissions for the GITHUB_TOKEN in GitHub Actions workflows using 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/hashicorp/terraform/actions/runs/3167052373/jobs/5157241888#step:1:19

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

  • issue-comment-created.yml
  • lock.yml
  • main.yml

Motivation and Context

  • This is a security best practice, so if the GITHUB_TOKEN is compromised due to a vulnerability or compromised Action, the damage will be reduced.
  • GitHub recommends defining minimum GITHUB_TOKEN permissions.
  • The Open Source Security Foundation (OpenSSF) Scorecards also treats not setting token permissions as a high-risk issue. This change will help increase the Scorecard score for this repository.

Signed-off-by: Ashish Kurmi akurmi@stepsecurity.io

Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
@crw
Copy link
Collaborator

crw commented Oct 3, 2022

Thanks for this submission! The safety and security of our products is deeply important to us. Our build process is designed and vetted by our internal release engineering and security teams. Although we do not typically accept pull requests for the build and release process, I will run this PR past those teams for review. Thanks for your consideration on this issue.

@crw
Copy link
Collaborator

crw commented Oct 3, 2022

Hi @boahc077, this PR looked familiar so I did a little digging, and this appears to be almost identical to #31863 -- I am going to close this PR, can you please leave any feedback on implementation in the previously-opened PR? Thanks!

@crw crw closed this Oct 3, 2022
@crw crw added enhancement duplicate issue closed because another issue already tracks this problem labels Oct 3, 2022
@github-actions
Copy link

github-actions bot commented Nov 3, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate issue closed because another issue already tracks this problem enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants