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

GitHub Workflows security hardening #1724

Merged
merged 1 commit into from
Sep 25, 2023
Merged

GitHub Workflows security hardening #1724

merged 1 commit into from
Sep 25, 2023

Conversation

sashashura
Copy link
Contributor

This PR adds explicit permissions section to workflows. This is a security best practice because by default workflows run with extended set of permissions (except from on: pull_request from external forks). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an injection or compromised third party tool or action) is restricted.
It is recommended to have most strict permissions on the top level and grant write permissions on job level case by case.

Copy link

@LeoDog896 LeoDog896 left a comment

Choose a reason for hiding this comment

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

LGTM! This PR is very important -- you may want to request reviews from the contributors for this.

Signed-off-by: Alex <aleksandrosansan@gmail.com>
@SethFalco
Copy link
Member

SethFalco commented Sep 25, 2023

Thanks for the explanation and resources! I'd actually read into the topic before, but didn't see the use for it at the time. Especially as actions/checkout and GitHub's own repositories don't configure these permissions for their workflows either.

I suppose the main benefit for us is that if we do accidentally merge a malicious pull request, it minimizes the damage that can be done on a push event later. For example, if main ends up directly or indirectly installing a vulnerable or compromised npm package after updating direct dependencies.

@SethFalco SethFalco merged commit 9a83ed4 into svg:main Sep 25, 2023
5 checks passed
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

3 participants