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

[ci] GitHub Workflows security hardening #4130

Merged
merged 3 commits into from Sep 30, 2022
Merged

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.

Signed-off-by: Alex <aleksandrosansan@gmail.com>
Signed-off-by: Alex <aleksandrosansan@gmail.com>
@oowekyala oowekyala changed the title GitHub Workflows security hardening [ci] GitHub Workflows security hardening Sep 21, 2022
@adangel adangel added this to the 6.50.0 milestone Sep 30, 2022
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I think for the build.yml workflow, we need also write access for contents. We use currently this workflow for everything: building from PRs, building from pushes, building from pushes to tags. And that creates a new release. We also update the branch "gh-pages" during the build, that means, we do a git-push against the our repo.

I have some idea in mind to refactor the workflow to make it into smaller chunks, but that's out of scope for now.

@pmd-test
Copy link

1 Message
📖 No regression tested rules have been changed.

Generated by 🚫 Danger

@sashashura
Copy link
Contributor Author

I see, you are right.

@adangel adangel merged commit 81a8ba0 into pmd:master Sep 30, 2022
adangel added a commit to adangel/pmd that referenced this pull request Sep 30, 2022
adangel added a commit to adangel/pmd that referenced this pull request Sep 30, 2022
[ci] GitHub Workflows security hardening pmd#4130
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