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: Update fixer UI to handle long running fixers #39301

Merged
merged 97 commits into from
Sep 23, 2024

Conversation

dkmyta
Copy link
Contributor

@dkmyta dkmyta commented Sep 9, 2024

Description

Identifies when an in_progress fixer has been running for more than 24 hours and displays as stale.

Dependant on 107053-ghe-Automattic/vaultpress

Proposed changes:

  • Use last_updated property to determine if an in_progress fixer is stale
  • Add a conditional IconTooltip to provide an explanation for this, prompt support request
  • Disable applicable actions when a fixer is in_progress or considered stale
  • Filter the fixableThreats list for the Fix all threat modal when we determine that in_progress or stale fixers exist (to avoid subsequent fixer attempts, and ignore action being triggered)
  • Add handling for the fixer status for threats that do not have a fixer queued but that might be returned in the fixer status response (not_started), to ensure that they are not included in the success and failure notice counts

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?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

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

  • No

Testing instructions:

  • Checkout this branch
  • Start Jurassic Tube
  • Install/activate Protect and upgrade
  • Activate the Jetpack Debug Tool and add fixable threats
  • Trigger a new scan to detect them
  • From dev console, log out jetpackProtectInitialState and identify the fixable threats IDs (status.fixable_threat_ids)
  • Update CredentialGate component to disable it
  • Update REST_Controller::api_fix_threats to return the following (be sure to replace $threat_id with the actual ID of the fixable threat, and $current_date accordingly) to disable actually fixing the threat:
[ 'ok' => true, 'threats' => [ $threat_id => [ 'status' => 'in_progress', 'last_updated' => $current_date ] ] ];
  • Update REST_Controller::api_fix_threats_status to return the following (be sure to replace $threat_id with the actual ID of the fixable threat) to simulate the return of a stale in_progress:
[ 'ok' => true, 'threats' => [ $threat_id => [ 'status' => 'in_progress', 'last_updated' => "2024-01-01 00:00:01" ] ] ];
  • Trigger the fixer(s) and verify that upon the completion of the first fixer status request the UI updates to display that the selected fixer is stale, fixer status polling stops, and an error notice is displayed
  • Ensure that you are unable to ignore and initiate a fix on any threats that has an in_progress or "stale" fixer status from either the main threats list threat card or the Fix all threats modal checklist
  • Test separately on a Jurassic Ninja site using the beta tester and the branch without the modifications and ensure that no regressions in functionality are introduced

Base automatically changed from add/protect-fixer-status-to-initial-state to trunk September 16, 2024 16:50
nateweller
nateweller previously approved these changes Sep 17, 2024
@dkmyta dkmyta merged commit cec62c8 into trunk Sep 23, 2024
54 checks passed
@dkmyta dkmyta deleted the update/protect-fixer-ui-to-handle-long-running-fixers branch September 23, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Protect Models [Package] Protect Status [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants