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

Jetpack: Update WAF settings UI to allow toggling of automatic and manual rules independently #27785

Merged
merged 49 commits into from
Jan 9, 2023

Conversation

nateweller
Copy link
Contributor

@nateweller nateweller commented Dec 6, 2022

Changes proposed in this Pull Request:

  • Updates the Jetpack Firewall settings UI to use the new automatic/manual rules toggling pattern.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?

Jetpack product discussion

peb6dq-hs-p2

1201069996155224-as-1203286905507161

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

No

Testing instructions:

  • Go to /wp-admin/admin.php?page=jetpack#/settings
  • Validate that the module can still be enabled and disabled by the primary firewall toggle.
  • Validate that automatic rules can not be toggled when the site does not have a scan plan.
  • Validate that automatic rules can be toggled on and off.

Screenshots

Screen Shot 2022-12-06 at 2 28 55 PM

@nateweller nateweller requested a review from a team December 6, 2022 20:56
@nateweller nateweller self-assigned this Dec 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run bin/jetpack-downloader test jetpack update/jetpack-waf-settings-ui to get started. More details: p9dueE-5Nn-p2

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress Admin Page React-powered dashboard under the Jetpack menu labels Dec 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 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.


🔴 Action required: Please add missing changelog entries for the following projects: projects/plugins/protect

Use the Jetpack CLI tool to generate changelog entries by running the following command: jetpack changelog add.
Guidelines: /docs/writing-a-good-changelog-entry.md


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: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

Protect plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

@nateweller nateweller removed Admin Page React-powered dashboard under the Jetpack menu [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Dec 6, 2022
@nateweller nateweller mentioned this pull request Dec 6, 2022
2 tasks
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Admin Page React-powered dashboard under the Jetpack menu labels Dec 6, 2022
@nateweller
Copy link
Contributor Author

Will pick this one back up after #28049 and #28027 are in trunk 👍

Base automatically changed from add/waf-automatic-rules-file to add/protect-waf-phase-2 January 4, 2023 21:32
@github-actions github-actions bot added the [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations label Jan 4, 2023
@nateweller nateweller added [Status] Needs Team Review and removed [Status] In Progress [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations labels Jan 4, 2023
@nateweller
Copy link
Contributor Author

Blocking PRs merged, pulled the latest from the project branch, and fixed some lingering issues.

Ready for re-review!

@dkmyta
Copy link
Contributor

dkmyta commented Jan 5, 2023

It would appear that automatic rules are still being enabled and included by default. On a fresh install with a Scan plan, when I activate the WAF module via Jetpack settings, I can see the rules directory is properly generated in the /wp-content/jetpack-waf folder but immediately includes the require for the automatic-rules.php file. In the UI, the initial toggling of the WAF module renders the correct display - the module is on, but all settings with the exception of the share data, show as disabled, however, automatic rules are running and upon refreshing the page, the automatic rule setting is toggled on.

I believe we now have a separate task dedicated to handling situations where the rules directory is manually deleted but I'd also like to note here that when we remove the rules directory generated by activating Protect, it will produce the same Failed to empty rules.php file. fatal error we've seen previously in Jetpack (this time without proper error handling) if/when we activate Jetpack.

@nateweller
Copy link
Contributor Author

@dkmyta Thanks for catching these issues! I've fixed both the auto-enabling of automatic rules, and addressed the "failed to empty rules.php" issue as well.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jan 5, 2023
@nateweller nateweller added this to the protect/1.2.1 milestone Jan 7, 2023
Copy link
Contributor

@dkmyta dkmyta left a comment

Choose a reason for hiding this comment

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

Works perfectly!

@nateweller nateweller merged commit d8516ef into add/protect-waf-phase-2 Jan 9, 2023
@nateweller nateweller deleted the update/jetpack-waf-settings-ui branch January 9, 2023 18:26
@github-actions github-actions bot removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Needs Team Review labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu E2E Tests [Package] WAF [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Status] Needs Test Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants