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

Protect: WAF share data toggle #27577

Merged
merged 7 commits into from
Nov 26, 2022

Conversation

dkmyta
Copy link
Contributor

@dkmyta dkmyta commented Nov 23, 2022

Description

Adds functionality to the CheckboxControl component within the FirewallFooter

Changes proposed in this Pull Request:

  • Adds the ability to toggle the jetpack_waf_share_data between true and false
  • Updates the CheckboxControl display depending on the setting
  • Hides the share-data-section when the WAF is disabled

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

  • 1201069996155224-as-1203282049665702

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

  • No

Testing instructions:

  • Start up a new Jurassic Ninja site using this Protect branch
  • Activate Protect and proceed to Protect admin page Firewall tab
  • Verify that the WAF is currently disabled and that the share-data-section is missing from the footer
  • Enable the WAF and verify that the section is rendered and currently set to off
  • Open your browser Dev Tools and review the Network tab
  • Toggle the checkbox on
  • Verify that a successful request is sent to the /waf endpoint to update jetpack_waf_share_data to true, that a subsequent request is sent to get the settings, and that the UI renders as expected
  • Refresh the page and ensure that checkbox remains on
  • Proceed similarly to disable share data

@github-actions github-actions bot added [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Status] In Progress labels Nov 23, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 23, 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.


Protect plugin:

  • Next scheduled release: December 6, 2022.
  • Scheduled code freeze: November 28, 2022.

Copy link
Contributor

@nateweller nateweller left a comment

Choose a reason for hiding this comment

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

Works great! :shipit:

@nateweller nateweller added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Team Review labels Nov 26, 2022
@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 Nov 26, 2022
@dkmyta dkmyta merged commit 668fa15 into add/protect-waf-mvp Nov 26, 2022
@dkmyta dkmyta deleted the add/protect-waf-share-data-toggle branch November 26, 2022 20:13
@github-actions github-actions bot removed [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 26, 2022
dkmyta added a commit that referenced this pull request Jan 10, 2023
* Initialize project branch

* Protect: Add WAF package (#27530)

* Protect: Clean up components (#27256)

* Protect: Add routing and blank Firewall page (#27245)

* Protect: Add Tabbed Navigation (#27259)

* Protect: Add "new" badge for users who have never viewed the Firewall tab (#27265)

* Protect: Add useWafData hook (#27307)

* Add: Protect WAF header (#27279)

* Add hook for interfacing with WAF data

* [not verified] Add firewall-header component folder structure

* [not verified] Apply header component code and styling

* [not verified] Remove unneeded comments

* [not verified] Update hasRequiredPlan check to useProtectData

* [not verified] Fix typo

* Add FirewallHeader component stories and improve portability

* Add useWafData hook placeholder for moduleIsEnabled check

* [not verified] Remove isModuleEnabled property in favor of currently available WAF data

* [not verified] Remove console logging

* [not verified] Add upgrade functionality to button

* [not verified] Add Popover component for upgrade info

* Fix styling issues

* Create ConnectedFirewallHeader component and move all logic out of FirewallPage

* Improve code efficiency

* Update FirewallHeader status check, and checkout flow redirect URL

* changelog

* [not verified] Remove changelog entry

* Change FirewallUrl to firewallUrl

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Protect: Add WAF footer (#27280)

* Add hook for interfacing with WAF data

* [not verified] Add firewall-header component folder structure

* [not verified] Apply header component code and styling

* [not verified] Remove unneeded comments

* [not verified] Update hasRequiredPlan check to useProtectData

* [not verified] Fix typo

* Add FirewallHeader component stories and improve portability

* Add useWafData hook placeholder for moduleIsEnabled check

* [not verified] Remove isModuleEnabled property in favor of currently available WAF data

* [not verified] Remove console logging

* [not verified] Add upgrade functionality to button

* [not verified] Add Popover component for upgrade info

* Introduce and apply FirewallFooter component

* Add central AdminSection component for better visualization

* Improve spacing

* [not verified] Apply initial run at StandaloneModeModal component

* [not verified] Update Footer component to ScanFooter

* [not verified] Improve StandaloneModeModal structure and styling

* [not verified] Add FirewallFooter stories

* [not verified] Update FirewallFooter to use SeventyFiveLayout

* [not verified] Update styling comments

* Fix styling issues

* Create ConnectedFirewallHeader component and move all logic out of FirewallPage

* Improve code efficiency

* Update FirewallHeader status check, and checkout flow redirect URL

* changelog

* [not verified] Remove changelog entry

* Change FirewallUrl to firewallUrl

* Fix styling issues

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Fix composer.json

* Changelog

* Protect: Add upgrade prompt while WAF enabled with no rules access (#27584)

* Add upgrade prompt when WAF enabled but no rules access

* Create separate internal component for upgrade prompt

* Add story for on with no plan

* WAF: Remove has_rules_access in favour of external checks (#27479)

* [not verified] Update WAF package to use portable Current_Plan over Jetpack_Plan for upgrade detection

* Add jetpack-plans dependency direct to the WAF package

* Add and use hasScan (over hasRulesAccess) check in Jetpack settings for the WAF module

* Remove hasRulesAccess property from WAF module component

* Remove has_rules_access method in favour of external plan checks

* Protect: Add Basic WAF Controls (#27291)

* Update Protect to version 1.2.0-alpha

* Protect: WAF share data toggle (#27577)

* [not verified] Add jetpack_waf_share_data option value to initial state, and use for checked value

* [not verified] Remove comments

* [not verified] Remove prior solution in favor of WAF endpoints solution and apply toggleShareData functionality to FirewallFooter checkbox

* [not verified] Improve share data toggle functionality

* [not verified] Improve code organization

* [not verified] Add isEnabled check for share data section display

* Remove wafShareData from initial state

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Changelogs

* Remove outdated TODO comment

* Protect: Add notices to the Firewall screen (#27621)

* Fix invalid HTML - pre cannot be a child of p

* Fix notice duration timeout

* Remove manual WAF initialization

* Register REST routes on WAF init

* Create foundation for automatic and manual rules usage separation

* Update naming

* Update WAF after settings have changed

* Add action for tracking initial WAF setup and use for loading header display, swap wording of WAF loading and updating actions, remove redundant actions from useWafData

* Remove comments and testing code

* Minor updates to pending conditional checks

* Add Now Available badge to automatic rules section and an action to check whether the WAF has been toggled since the upgrade

* Add popover for upgrade notice regarding automatic rules, assign same conditional as new feature badge

* Add option to temporarily dismiss the popover only, rather than permanently remove both popover and new feature badge

* Improve variable naming

* Revert changes to useWafData hook usage of setWafIsUpdating (previously setWafIsLoading)

* Add/remove styling comments

* Update tracks events in Jetpack Protect (#27659)

* Initialize project branch

* Initialize project branch

* Update mock data to include WAF properties

* Update FirewallHeader component to export sub component and import for story usage

* Improve upgrade popover and badge logic and handling

* Improve upgrade popover and badge logic and handling

* Remove auto vs manual toggle separation and upgrade messaging

* Delete old changelog entries

* Remove endpoints for upgrade messaging

* Remove upgrade messaging endpoints, handling, and content

* Remove state handlers for seen upgrade

* Remove unneeded comments

* Fix footer styling issues in mobile when WAF module not enabled

* Remove unneeded comments

* Add endpoints, methods, actions and handling for post upgrade messaging

* Extract JETPACK_SCAN variable to constants file

* Update automatic rules toggle to connect to correlated waf setting

* Ensure module is enabled before attempting to update settings

* Show a notice when the waf module is disabled

* [not verified] Activate WAF module on plugin activation

* Disable WAF controls when the module is disabled

* Document and organize FirewallPage

* Include automatic rules in default formState object

* Update styles

* Remove CurrentlyEnabledFeatures

* Fix saving of automatic rules option in endpoint

* Remove testing code

* Revert Boost changes introduced in merge

* [not verified] Revert Boost changes forced by commit actions

* Initialize project branch

* [not verified] Revert unrelated masterbar changes auto-merged

* Fix indentation

* Improve organization and efficiency

* Remove unneeded REST_Controller class methods, and apply class and styling suggestions

Co-authored-by: Nate Weller <nate.weller@automattic.com>
dkmyta added a commit that referenced this pull request Feb 22, 2023
* Initialize project branch

* Protect: Add WAF package (#27530)

* Protect: Clean up components (#27256)

* Protect: Add routing and blank Firewall page (#27245)

* Protect: Add Tabbed Navigation (#27259)

* Protect: Add "new" badge for users who have never viewed the Firewall tab (#27265)

* Protect: Add useWafData hook (#27307)

* Add: Protect WAF header (#27279)

* Add hook for interfacing with WAF data

* [not verified] Add firewall-header component folder structure

* [not verified] Apply header component code and styling

* [not verified] Remove unneeded comments

* [not verified] Update hasRequiredPlan check to useProtectData

* [not verified] Fix typo

* Add FirewallHeader component stories and improve portability

* Add useWafData hook placeholder for moduleIsEnabled check

* [not verified] Remove isModuleEnabled property in favor of currently available WAF data

* [not verified] Remove console logging

* [not verified] Add upgrade functionality to button

* [not verified] Add Popover component for upgrade info

* Fix styling issues

* Create ConnectedFirewallHeader component and move all logic out of FirewallPage

* Improve code efficiency

* Update FirewallHeader status check, and checkout flow redirect URL

* changelog

* [not verified] Remove changelog entry

* Change FirewallUrl to firewallUrl

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Protect: Add WAF footer (#27280)

* Add hook for interfacing with WAF data

* [not verified] Add firewall-header component folder structure

* [not verified] Apply header component code and styling

* [not verified] Remove unneeded comments

* [not verified] Update hasRequiredPlan check to useProtectData

* [not verified] Fix typo

* Add FirewallHeader component stories and improve portability

* Add useWafData hook placeholder for moduleIsEnabled check

* [not verified] Remove isModuleEnabled property in favor of currently available WAF data

* [not verified] Remove console logging

* [not verified] Add upgrade functionality to button

* [not verified] Add Popover component for upgrade info

* Introduce and apply FirewallFooter component

* Add central AdminSection component for better visualization

* Improve spacing

* [not verified] Apply initial run at StandaloneModeModal component

* [not verified] Update Footer component to ScanFooter

* [not verified] Improve StandaloneModeModal structure and styling

* [not verified] Add FirewallFooter stories

* [not verified] Update FirewallFooter to use SeventyFiveLayout

* [not verified] Update styling comments

* Fix styling issues

* Create ConnectedFirewallHeader component and move all logic out of FirewallPage

* Improve code efficiency

* Update FirewallHeader status check, and checkout flow redirect URL

* changelog

* [not verified] Remove changelog entry

* Change FirewallUrl to firewallUrl

* Fix styling issues

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Fix composer.json

* Changelog

* Protect: Add upgrade prompt while WAF enabled with no rules access (#27584)

* Add upgrade prompt when WAF enabled but no rules access

* Create separate internal component for upgrade prompt

* Add story for on with no plan

* WAF: Remove has_rules_access in favour of external checks (#27479)

* [not verified] Update WAF package to use portable Current_Plan over Jetpack_Plan for upgrade detection

* Add jetpack-plans dependency direct to the WAF package

* Add and use hasScan (over hasRulesAccess) check in Jetpack settings for the WAF module

* Remove hasRulesAccess property from WAF module component

* Remove has_rules_access method in favour of external plan checks

* Protect: Add Basic WAF Controls (#27291)

* Update Protect to version 1.2.0-alpha

* Protect: WAF share data toggle (#27577)

* [not verified] Add jetpack_waf_share_data option value to initial state, and use for checked value

* [not verified] Remove comments

* [not verified] Remove prior solution in favor of WAF endpoints solution and apply toggleShareData functionality to FirewallFooter checkbox

* [not verified] Improve share data toggle functionality

* [not verified] Improve code organization

* [not verified] Add isEnabled check for share data section display

* Remove wafShareData from initial state

Co-authored-by: Nate Weller <nate.weller@automattic.com>

* Changelogs

* Remove outdated TODO comment

* Protect: Add notices to the Firewall screen (#27621)

* Fix invalid HTML - pre cannot be a child of p

* Fix notice duration timeout

* Remove manual WAF initialization

* Register REST routes on WAF init

* Update WAF after settings have changed

* Update tracks events in Jetpack Protect (#27659)

* Initialize project branch

* Initialize project branch

* Add existing plan link to pricing page and fix registration redirect to check for plan when rendering the UI

* Initialize project branch

* Remove changelog entries

* Use addQueryArgs and getQueryArgs to check plan and redirect after successful user connection

* Update redirect handling after user connection to managed with PHP

* changelog

* Initial commit.

* Check for licenses and redirect users to the license activation page.

* Add changelogs and version bumps.

* Add changelog files.

* Adding filter to backup class

* changelog

* Fix constant naming

* Add Jetpack Complete plan ID's.

* Add the filter comment.

* Revert prior changes and update as per new standards

* Update filter callback format

* Revert changes to getProtectFree registration flow

* Add plan and status refresh to getProtectFree reg flow and update getStarted button to have a unique loading state

* Require jetpack-connection package

* Revert direct require of jetpack-connection package

* Add checkout flow to get started button to handle license check

* Provide plugins with a plugin slug to make sure we only verify licenses for the products we need.

* Fix license check based on the plugin slug.

* If an appropriate unattached license is found, check if the plugin already has a license activated on the site before redirecting them.

* Move the license check code from connection to licensing package.

* Update changelog files.

* Bump package version.

* Replace parse_url() with wp_parse_url().

* Update license check callback to include a plan check

* Update UI handling for the loading of various buttons

* Remove siteProductAvailabilityHandler arg in the existing checkout flow in favour of plan check in the filter callback

* Fix project versions

* Add missing product IDs, remove plan check from filter callback in favour of reattaching siteProductAvailabilityHandler to the checkout flow

---------

Co-authored-by: Nate Weller <nate.weller@automattic.com>
Co-authored-by: Sergey Mitroshin <sergeymitr@gmail.com>
Co-authored-by: bindlegirl <1242807+bindlegirl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants