Skip to content

chore: Set permissions for GitHub actions #2605

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

Merged
merged 1 commit into from
Jun 11, 2022

Conversation

naveensrinivasan
Copy link
Contributor

Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests

Signed-off-by: naveen [email protected]

 Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <[email protected]>
@pirj
Copy link
Member

pirj commented Jun 6, 2022

I guess the key here is:

If you specify the access for any of these scopes, all of those that are not specified are set to none.

@pirj
Copy link
Member

pirj commented Jun 6, 2022

I can't find the default values for permissions. Are they all on by default?
Unrelated to this PR, just in general. This seems to be a major security hole. What is the impact? Is it possible to steal secret keys, e.g. for repository push access, if there's something like "publish doc changes in gh-pages branch" flow?
Is there a related GH ticket (https://github.com/github/securitylab or https://github.com/actions/runner)?

@naveensrinivasan
Copy link
Contributor Author

I can't find the default values for permissions. Are they all on by default?

AFAIK they are on by default because GH Action wasn't designed with permissions.

Unrelated to this PR, just in general. This seems to be a major security hole. What is the impact? Is it possible to steal secret keys, e.g. for repository push access, if there's something like "publish doc changes in gh-pages branch" flow?
Is there a related GH ticket (https://github.com/github/securitylab or https://github.com/actions/runner)?

@pirj pirj requested a review from JonRowe June 6, 2022 18:38
@pirj
Copy link
Member

pirj commented Jun 6, 2022

To spare you of the burden of dealing with the rest of our repos, I'll replicate those changes myself if @JonRowe approves.

@JonRowe JonRowe merged commit 5ab5300 into rspec:main Jun 11, 2022
@JonRowe
Copy link
Member

JonRowe commented Jun 11, 2022

Thanks!

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 this pull request may close these issues.

3 participants