Skip to content

Restrict permissions for GitHub actions - #2334

Merged
gmlewis merged 1 commit into
google:masterfrom
turrisxyz:naveen/feat/set-perms-actions
Apr 14, 2022
Merged

Restrict permissions for GitHub actions#2334
gmlewis merged 1 commit into
google:masterfrom
turrisxyz:naveen/feat/set-perms-actions

Conversation

@naveensrinivasan

Copy link
Copy Markdown
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-permissionshttps://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissionshttps://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
Copy Markdown
Collaborator

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
Copy Markdown
ContributorAuthor

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

codecovBot commented Apr 14, 2022

Copy link
Copy Markdown

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.

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

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.

@gmlewisgmlewis changed the title Set permissions for GitHub actionsRestrict permissions for GitHub actionsApr 14, 2022
@gmlewis
gmlewis merged commit 00e4233 into google:masterApr 14, 2022
@naveensrinivasan
naveensrinivasan deleted the naveen/feat/set-perms-actions branch April 14, 2022 16:12
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto 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.

2 participants

@naveensrinivasan@gmlewis