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: Add routing and blank Firewall page #27245

Merged
merged 11 commits into from
Nov 21, 2022

Conversation

nateweller
Copy link
Contributor

Changes proposed in this Pull Request:

  • This PR introduces react-router-dom to Protect, in order to provide routing for the sub-sections within the admin area.
  • The default path directs to the existing <AdminPage />, and a new <FirewallPage /> is added to the /firewall route.
  • A <ScrollToTop /> component is added to automatically scroll the user to the top of the page on route change.

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

1202232924268038-as-1203279663034176

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

No

Testing instructions:

  • Validate that /wp-admin/admin.php?page=jetpack-protect renders the <AdminPage /> component as usual.
  • Validate that /wp-admin/admin.php?page=jetpack-protect#/firewall renders the empty <FirewallPage /> component.

Screen Shot 2022-11-02 at 5 08 30 PM

@nateweller nateweller added [Status] In Progress [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. labels Nov 2, 2022
@nateweller nateweller requested a review from a team November 2, 2022 23:11
@nateweller nateweller self-assigned this Nov 2, 2022
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

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

@nateweller nateweller changed the base branch from add/scan-in-protect to update/protect-reorg-components November 3, 2022 19:45
@nateweller nateweller marked this pull request as ready for review November 3, 2022 21:32
@nateweller nateweller mentioned this pull request Nov 4, 2022
2 tasks
@nateweller nateweller mentioned this pull request Nov 21, 2022
2 tasks
@nateweller nateweller force-pushed the update/protect-reorg-components branch from c10236e to 50ad35d Compare November 21, 2022 18:35
@nateweller nateweller force-pushed the add/protect-hash-routing branch 3 times, most recently from e0047ca to 144532c Compare November 21, 2022 21:22
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 great! A few minor merge conflicts to address, but otherwise ready to go!

Base automatically changed from update/protect-reorg-components to add/protect-waf-mvp November 21, 2022 23:06
@nateweller nateweller merged commit 10b9e1d into add/protect-waf-mvp Nov 21, 2022
@nateweller nateweller deleted the add/protect-hash-routing branch November 21, 2022 23:16
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