-
-
Notifications
You must be signed in to change notification settings - Fork 605
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 #1470
Conversation
|
Codecov ReportBase: 96.81% // Head: 96.81% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #1470 +/- ##
=======================================
Coverage 96.81% 96.81%
=======================================
Files 12 12
Lines 1131 1131
Branches 411 411
=======================================
Hits 1095 1095
Misses 27 27
Partials 9 9 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@snitin315 thanks so much for reviewing my PR. I looked at the failed lint check. It appears to be a Node linter. Whereas the change I am making is related to GitHub actions which is uses YAML. Is there any way to add exceptions for such failures as it may not applicable for this PR? |
lint is failing for the cancel.yml file so it is related. Please run prettier locally to fix lint. |
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
@snitin315 thanks for the pointer. I ran prettier locally to fix cancel.yaml. There was an extra space in my YAML comment. I made the fix and squashed my previous two commits. Please take a look again. |
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/webpack-contrib/css-loader/runs/8160728230?check_suite_focus=true#step:1:19
After this change, the scopes will be reduced to the minimum needed for the following workflow:
The following workflow file already has the least privileged token permission set:
Motivation and Context
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
Signed-off-by: Ashish Kurmi akurmi@stepsecurity.io