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

Merged
merged 1 commit into from
Sep 13, 2022

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.

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/argoproj/argo-workflows/runs/8125260622?check_suite_focus=true#step:1:19

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

  • changelog.yaml
  • ci-build.yaml
  • gh-pages.yaml
  • release.yaml
  • sdks.yaml
  • snyk.yml

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

  • dependabot-reviewer.yml

Motivation and Context

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

@alexec
Copy link
Contributor

alexec commented Sep 9, 2022

These work fine today. Why change them?

@ashishkurmi
Copy link
Contributor Author

https://github.com/argoproj/argo-workflows/runs/8125260622?check_suite_focus=true#step:1:19

Thanks for reviewing my PR @alexec. If you visit https://github.com/argoproj/argo-workflows/runs/8125260622?check_suite_focus=true#step:1:19, you would see that all GitHub action workflows have elevated GitHub token permissions which increases the attack surface drastically. I calculated minimum token permissions based on the actions included in these workflows, you would see that most of them only need limited read access. This change will update token permissions for all workflows so that they operate at the least privileged level as opposed to using an elevated GitHub token by default.

@terrytangyuan terrytangyuan merged commit ee4df02 into argoproj:master Sep 13, 2022
juchaosong pushed a commit to juchaosong/argo-workflows that referenced this pull request Nov 3, 2022
@agilgur5 agilgur5 added type/security Security related area/build Build or GithubAction/CI issues labels Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues type/security Security related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants