Skip to content

Conversation

@dkmyta
Copy link
Contributor

@dkmyta dkmyta commented May 4, 2022

Changes proposed in this Pull Request:

  • This PR implements a set of killswitch define checks within:
    • The WAF package's main actions.php file to prevent the package code from running
    • The wp-content/jetpack-waf/bootstrap.php file generated by class-waf-standalone-bootstrap.php to cover any edge cases where the package had already been set up in standalone mode.

Jetpack product discussion

Does this pull request change what data or activity we track or use?

  • No

Testing instructions:

  • Checkout this branch.
  • Fire up your Jurassic Tube instance.
  • To verify the actions.php killswitch define check:
    • Add var_dump( ’Testing main killswitch’ ); die(); directly after the closing curly brace of the killswitch define check.
    • Load your site, and confirm that the WAF code runs and that the Testing main killswitch string is displayed.
    • Define the DISABLE_JETPACK_WAF constant as true, either in advance of the check in actions.php or within your wp-config.php.
    • Reload your site, and confirm that we've bailed on the WAF code and that WordPress now loads and functions as expected.
  • To verify the bootstrap.php killswitch define check:
    • Add . "var_dump( 'Testing standalone killswitch' ); die();\n” as the initial line for the $code variable in the generate() method in class-waf-standalone-bootstrap.php.
    • Run jetpack docker wp jetpack-waf mode normal to set the WAF mode and generate/update the bootstrap file.
    • Confirm that the wp-contents/jetpack-waf folder exists and contains a bootstrap.php file with the contents of the $code variable, including the new testing additions.
    • Visit your .htaccess file and add the following code to trigger standalone mode php_value auto_prepend_file “/var/www/html/wp-content/jetpack-waf/bootstrap.php”.
    • Load your site and confirm that the bootstrap file has run and that the Testing standalone killswitch string is displayed.
    • Remove and replace the testing string beneath the killswitch define check.
    • Re-run the CLI command to update mode and verify that changes have been applied to the bootstrap file.
    • Load the site and confirm the string remains visible.
    • Edit the bootstrap file to define the DISABLE_JETPACK_WAF constant as true.
    • Reload the site and confirm that WordPress now loads and runs as expected, instead of the bootstrap code.

@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: June 7, 2022.
  • Scheduled code freeze: May 31, 2022.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 4, 2022
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label May 4, 2022
@dkmyta dkmyta requested a review from a team May 8, 2022 17:47
@dkmyta dkmyta added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels May 8, 2022
@dkmyta dkmyta marked this pull request as ready for review May 8, 2022 17:50
singerb
singerb previously approved these changes May 10, 2022
Copy link
Contributor

@singerb singerb left a comment

Choose a reason for hiding this comment

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

Code looks good, very thorough PR description! May need some updates for version stuff depending on what merges first.

@dkmyta dkmyta enabled auto-merge (squash) May 10, 2022 23:30
Copy link
Contributor

@singerb singerb left a comment

Choose a reason for hiding this comment

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

Still looks good, should merge now assuming checks pass.

@dkmyta dkmyta merged commit dd346d3 into master May 11, 2022
@dkmyta dkmyta deleted the add/waf-killswitch-define branch May 11, 2022 16:37
@github-actions github-actions bot added this to the jetpack/11.0 milestone May 11, 2022
@github-actions github-actions bot removed the [Status] Needs Team Review Obsolete. Use Needs Review instead. label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] WAF [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants