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 Phase 3 #28046

Merged
merged 60 commits into from
Jan 19, 2023
Merged

Conversation

dkmyta
Copy link
Contributor

@dkmyta dkmyta commented Dec 21, 2022

Project branch for adding the third iteration of the WAF integration in Jetpack Protect.

Changes proposed in this Pull Request:

Task PR Status
Add rules versioning D95826-code 🟣 Merged
Add post-upgrade messaging #27787 🟣 Merged
Add Waf_Stats class #27970 🟣 Merged
Add stats to controls #28017 🟣 Merged
Add waf-stats endpoint for blocked requests D95622-code 🟢 In-Progress
Add blocked requests stats to Waf_Stats class #28277 🟢 In-Progress
Add stats to header #27914 🟢 In-Progress
Clean the blocklog file on HTTP only connections 🟢 In-Progress
Extract REST API logic from main plugin class #28217 🟣 Merged

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-4G-p2

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

TBD

Testing instructions:

  • TBD

…d hooks regardless if rules are enabled or not
@nateweller nateweller closed this Jan 7, 2023
@nateweller nateweller force-pushed the add/protect-waf-phase-3 branch from 15e58b8 to a6367b5 Compare January 7, 2023 18:29
Base automatically changed from update/jetpack-waf-settings-ui to add/protect-waf-phase-2 January 9, 2023 18:26
@github-actions github-actions bot added [Status] Needs Test Review Admin Page React-powered dashboard under the Jetpack menu E2E Tests labels Jan 9, 2023
dkmyta and others added 5 commits January 10, 2023 09:20
* 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>
* Add a class for communicating with wpcom to retrieve WAF stats

* changelog

* Add further Waf_Stats methods for available items

* Add further Waf_Stats methods for available items

* Update get_rules_last_updated to supply a usable date over a timestamp

* Add realistic placeholder for blockedRequest stats

* Initialize project branch

* Align arrows, revert unrelated masterbar changes auto-merged

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

* Update get_waf_stats to use new automatic rules last update timestamp

* Update function call accordingly

* Update Waf_Stats IP list counter methods to consider the possibility that the options aren't yet set

* Update Waf_Stats methods and Protect initial state

* Introduce get_waf_stats main plugin class method for better initial state organization

* Remove all blocked requests related code

* Update snake_case to camelCase for WAF stats array keys

* Return timestamp or false for automatic rules last updated stat
@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2023

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-waf-phase-3 to get started. More details: p9dueE-5Nn-p2

@nateweller nateweller marked this pull request as ready for review January 19, 2023 22:06
@nateweller
Copy link
Contributor

We are going to delay the work on the following tasks, while we work on a new solution to where we store the stats:

Task PR Status
Add waf-stats endpoint for blocked requests D95622-code 🟢 In-Progress
Add blocked requests stats to Waf_Stats class #28277 🟢 In-Progress
Add stats to header #27914 🟢 In-Progress
Clean the blocklog file on HTTP only connections   🟢 In-Progress

I'm going to approve this branch and merge it into our Phase 2 PR 👍

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.

🚀

@nateweller nateweller merged commit b9d511e into add/protect-waf-phase-2 Jan 19, 2023
@nateweller nateweller deleted the add/protect-waf-phase-3 branch January 19, 2023 22:09
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.

3 participants