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

Restrict permissions for GitHub actions #2334

Merged
merged 1 commit into from Apr 14, 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.

- 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: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
@gmlewis
Copy link
Collaborator

gmlewis commented Apr 13, 2022

In all the links you provided, I didn't see any need or example for adding actions: write.
Can you please convince me that it is needed?
What would fail if we have actions: read ?

@naveensrinivasan
Copy link
Contributor Author

In all the links you provided, I didn't see any need or example for adding actions: write.
Can you please convince me that it is needed?

This has the https://github.com/styfle/cancel-workflow-action permissions https://github.com/styfle/cancel-workflow-action#advanced-token-permissions HTH.

What would fail if we have actions: read ?

I don't know. Probably asking the owner of the action would help.

@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #2334 (d762d48) into master (edc25cb) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2334   +/-   ##
=======================================
  Coverage   98.04%   98.04%           
=======================================
  Files         118      118           
  Lines       10458    10458           
=======================================
  Hits        10254    10254           
  Misses        140      140           
  Partials       64       64           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edc25cb...d762d48. Read the comment docs.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @naveensrinivasan - LGTM.
Merging.

@gmlewis gmlewis changed the title Set permissions for GitHub actions Restrict permissions for GitHub actions Apr 14, 2022
@gmlewis gmlewis merged commit 00e4233 into google:master Apr 14, 2022
@naveensrinivasan naveensrinivasan deleted the naveen/feat/set-perms-actions branch April 14, 2022 16:12
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.

None yet

2 participants