-
Notifications
You must be signed in to change notification settings - Fork 4.6k
GitHub Actions workflow hardening #69126
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Size Change: 0 B Total Size: 1.85 MB ℹ️ View Unchanged
|
This comment was marked as off-topic.
This comment was marked as off-topic.
…se of these will be proposed separately.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| name: Lint GitHub Actions workflow files | ||
|
|
||
| on: | ||
| push: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also include this for the wp/X.Y branches? Going forward, this would lint suggested changes to the workflows in these branches, which are used to push out point releases for older versions of WP when necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I think that means we can only start doing that with the next point release after this is merged, do you agree?
desrosj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, @johnbillion! Let's give it a go!
| jobs: | ||
| # Runs the actionlint GitHub Action workflow file linter. | ||
| # | ||
| # This helps guard against common mistakes including strong type checking for expressions (${{ }}), security checks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this also checks the permissions: {} top level permissions too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionlint only checks that the given permission scopes and access levels are valid -- both at the top level workflow level and the job level -- ie. it lints them but doesn't check for overly broad permissions. Zizmor does check for excessive permissions, but I will be writing a separate proposal for adopting that.
What?
These changes harden the security of the GitHub Actions workflows. GitHub Actions workflows operate in a highly privileged software supply chain environment, for example they have access to publish npm packages, deploy the plugin to the WordPress.org plugin directory, and push commits to the repo. Hardening these workflows reduces the attack surface available to vulnerabilities and malicious actors.
See WordPress/wordpress-develop#8007 for where the same thing was done for the
wordpress-developrepo.permissionsdeclarations to workflows and jobs.Not all workflows are testable in isolation, so we will need to check each subsequent run of affected workflows when they next run. We learnt a few things after making these changes in the
wordpress-developrepo, so hopefully everything has been accounted for. The actionlint workflow helps a great deal.Why?
GitHub Actions workflows are highly privileged. They can push to the repo, they can publish packages, and they work with inputs that shouldn't necessarily be trusted. Hardening the workflows reduces the attack surface for including malicious code in a package or exposing sensitive information.
Notes
wordpress-developandgutenbergrepos.References