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

Add minimal permissions to GitHub workflows #176

Closed
pnacht opened this issue Apr 10, 2023 · 0 comments · Fixed by #177
Closed

Add minimal permissions to GitHub workflows #176

pnacht opened this issue Apr 10, 2023 · 0 comments · Fixed by #177
Assignees

Comments

@pnacht
Copy link
Contributor

pnacht commented Apr 10, 2023

By default, GitHub workflows run with write-all permissions. This is dangerous, since it opens the project up to supply-chain attacks. GitHub itself recommends ensuring all workflows run with minimal permissions.

I've taken a look at logr's workflows, and most only need read-only access. As such, I'd like to help the project patch up this vulnerability.

This issue can be solved in two ways:

  • add top-level read-only permissions to all workflows, and then give additional job-level permissions as necessary; and/or
  • set the default token permissions to read-only in the repo settings.

I'll be sending a PR along with this issue that sets the top-level permissions as well as the additional permissions required for assign.yml.

If you instead (or also) wish to modify the default token permissions:

  1. Open the repo settings
  2. Go to Actions > General
  3. Under "Workflow permissions", set them to "Read repository contents and packages permissions"

If you only wish to modify the default token permissions, know that you'll need to modify assign.yaml, since it requires some additional permissions.


Disclosure: My name is Pedro and I work with Google and the Open Source Security Foundation (OpenSSF) to improve the supply-chain security of the open-source ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants