-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ci: add GitHub token permissions for workflows #47652
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
Conversation
Signed-off-by: Varun Sharma <[email protected]>
Signed-off-by: Varun Sharma <[email protected]>
If we set |
.github/workflows/stale-pr.yml
Outdated
jobs: | ||
stale: | ||
permissions: | ||
issues: write # for actions/stale to close stale issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not closing the prs, the not only adds a label stale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @phofl, is your ask to remove or change the comment? Just wanted to confirm before making the change.
I can remove the comment or change it to to label stale PRs
.
Also, looks like this workflow does not update stale issues. If that is the case, I can remove the issues: write
permission.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This action only adds a stale
label and writes one comment to a PR, so whatever permission are needed to perform those actions can be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated stale-pr.yml
. Removed issues: write
since issues are not being updated based on the config. Also removed the comment for pull-requests: write
.
Hi @mroeschke yes, that is true. At the same time, it is a best practice to set the permissions in the workflow files explicitly.
So, setting |
Thanks for the explanation. Agreed to make these explicit in the the yaml files then |
Signed-off-by: Varun Sharma <[email protected]>
Thanks @varunsh-coder |
* ci: add GitHub token permissions for workflows Signed-off-by: Varun Sharma <[email protected]> * trim trailing whitespace Signed-off-by: Varun Sharma <[email protected]> * Update stale-pr.yml Signed-off-by: Varun Sharma <[email protected]>
This PR adds minimum token permissions for the GITHUB_TOKEN using https://github.com/step-security/secure-workflows.
GitHub recommends defining minimum GITHUB_TOKEN permissions for securing GitHub Actions workflows
This project is part of the top 100 critical projects as per OpenSSF (https://github.com/ossf/wg-securing-critical-projects), so fixing the token permissions to improve security.
Signed-off-by: Varun Sharma [email protected]
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.