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

Upgrade PHPCS standards and fix issues, excluding ExceptionNotEscaped. #8942

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

benbowler
Copy link
Collaborator

@benbowler benbowler commented Jul 1, 2024

Summary

Addresses issue:

Relevant technical choices

I updated the suggested packages and their dependencies, then worked through many new fixes and addressed them using lint-fix and manually.

The only rule that I suggest we address in a follow up issue is WordPress.Security.EscapeOutput.ExceptionNotEscaped, which I've disabled here for now. There are many examples where we return variables in our error response strings. As mentioned in this thread, the security impact here is for uncaught/handled errors for:

people having display_errors on (which is PHP's default) and html_errors off (which is not the default)

In our usage we may be able to skip many of these where the errors are part of REST endpoints where the response won't be rendered in the users site/plugin dashboard. Other core plugin exceptions should perhaps be escaped incase they are left uncaught and could return unescaped html on the plugin dashboard. Generally creating a new ticket will allow us to evaluate the possible impact through the AC/IB process.

Alternatively if we are clear that each error is correctly handled by the plugin we can permanently disable this rule.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Jul 1, 2024

Build files for e5e7835 have been deleted.

@benbowler benbowler force-pushed the infrastructure/8724-phpcs-updates branch 2 times, most recently from f220e61 to e555527 Compare July 1, 2024 10:06
@benbowler benbowler force-pushed the infrastructure/8724-phpcs-updates branch from e555527 to 9c3d558 Compare July 1, 2024 10:27
Copy link
Collaborator

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Looks good to me, just a merge conflict that needs to be resolved (sorry I took awhile to review this one, but after that should be good-to-go 😄)

I removed the QA Brief since it was really just a request for another code review, which I don't think is needed 😄

@tofumatt tofumatt merged commit 859295e into develop Jul 9, 2024
18 checks passed
@tofumatt tofumatt deleted the infrastructure/8724-phpcs-updates branch July 9, 2024 08:41
@@ -583,7 +583,7 @@ public static function get_platform() {
if ( is_multisite() ) {
return 'wordpress-multisite';
}
return 'wordpress'; // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
return 'WordPress'; // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @benbowler @tofumatt, this change is an error, and Site Kit is being rejected by the SKS during setup as a result.

image

This line, and the corresponding update to Google_ProxyTest.php need to be reverted.

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