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

security(workflow): Set permissions for GitHub actions #6820

Merged

Conversation

naveensrinivasan
Copy link
Contributor

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

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.

Signed-off-by: naveensrinivasan [email protected]

- 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/)

 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.

Signed-off-by: naveensrinivasan <[email protected]>
@davorpa davorpa added the 👀 Needs Review Is this really a good resource? Reviews requested. label Apr 9, 2022
@davorpa
Copy link
Member

davorpa commented Apr 9, 2022

With #6202 permissions needs be extended to read.

I also have in mind autotag PR with linter error label depend on linter status. How it would be?

@davorpa davorpa requested review from borgified and SethFalco April 9, 2022 10:16
@davorpa davorpa changed the title Set permissions for GitHub actions security(workflows): Set permissions for GitHub actions Apr 9, 2022
@naveensrinivasan
Copy link
Contributor Author

With #6202 permissions needs be extended to read.

Can that be a separate one?

I also have in mind autotag PR with linter error label depend on linter status. How it would be?

That is probably within your code in JS. I couldn't figure that out. You can set permissions specific to the Job using this https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions

permissions:
      issues: write

@davorpa
Copy link
Member

davorpa commented Apr 9, 2022

Thanks for your all support @naveensrinivasan!

Can that be a separate one?

Of course. It only was linked to take in mind this changes.

Let's wait what tell us other members with a bit more experience with GH actions. @SethFalco @borgified is this PR suitable and usefull?

@davorpa davorpa self-assigned this Apr 13, 2022
@davorpa davorpa added the help wanted Needs help solving a blocked / stucked item label May 2, 2022
Copy link
Member

@davorpa davorpa left a comment

Choose a reason for hiding this comment

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

LGTM after reading the documentation and some other @SethFalco 's messages about Actions security

It ensures same behavior across forks/origin with zero config

@davorpa davorpa added 🚀 ready to merge LGTM. Waiting for final approval 🤖 automation Automated tasks done by workflows or bots and removed help wanted Needs help solving a blocked / stucked item 👀 Needs Review Is this really a good resource? Reviews requested. labels Aug 10, 2022
@davorpa davorpa changed the title security(workflows): Set permissions for GitHub actions security(workflow): Set permissions for GitHub actions Aug 10, 2022
@eshellman eshellman merged commit bd1434f into EbookFoundation:main Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 automation Automated tasks done by workflows or bots 🚀 ready to merge LGTM. Waiting for final approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants