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

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

ashishkurmi
Copy link
Contributor

@ashishkurmi ashishkurmi commented Sep 8, 2022

Description

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

GitHub Actions workflows have a GITHUB_TOKEN with write access to multiple scopes.
Here is an example of the permissions in one of the workflows:
https://github.com/hashicorp/packer/runs/8239485051?check_suite_focus=true#step:1:19

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

  • auto-close-stale-issues.yml
  • issues.yml

The following workflow files already have the least privileged token permission set:

  • acceptance-test.yml
  • backport.yml
  • go-test.yml
  • issue-comment-created.yml
  • issues-opened.yml
  • lock.yml
  • nightly-release.yml
  • build.yml
  • check-plugin-docs.yml
  • go-validate.yml
  • issue-migrator.yml

Motivation and Context

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

@ashishkurmi ashishkurmi requested a review from a team as a code owner September 8, 2022 05:26
@hashicorp-cla
Copy link

hashicorp-cla commented Sep 8, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. I'm going to remove the file .github/workflows/issues.yml as it is no longer used but this is otherwise good to go.

@nywilken nywilken added the tech-debt Issues and pull requests related to addressing technical debt or improving the codebase label Sep 12, 2022
@nywilken nywilken merged commit 3bb02bf into hashicorp:main Sep 12, 2022
@github-actions
Copy link

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 issues.
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 Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tech-debt Issues and pull requests related to addressing technical debt or improving the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants