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: Fix checks for paid plan #27355

Merged
merged 13 commits into from
Nov 16, 2022
Merged

Conversation

nateweller
Copy link
Contributor

@nateweller nateweller commented Nov 10, 2022

Changes proposed in this Pull Request:

  • We've been having reliability issues using Scan::has_required_plan() from My_Jetpack due to server timeouts, this PR introduces a new way of validating the site plan using the connection package's Current_Plan. While the My Jetpack method validates the plan by availability of an accessible scan status, this alternate method directly checks the site's available features. This allows us to handle scenarios where the site has the correct plan, but no available scan status (i.e. right after purchase, the scanner may still be initializing and is "unavailable" for a few moments.)
  • This PR also updates what logic is ran by protect on the init hook, moving any code that relies on status data to _admin_menu, where it will be called only when necessary instead of every page load.

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-1203341574761584

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

No

Testing instructions:

  • Start up a JN site with Jetpack Beta running this branch for Protect, and no core Jetpack plugin installed.
  • Go through the process of activating Protect as a paid and free user, validating both experiences use the proper UI and status data source.
  • Manually upgrade or cancel your plan outside of wp-admin, and validate the correct plan is immediately recognized in Protect.

@nateweller nateweller added [Type] Bug When a feature is broken and / or not performing as intended [Status] In Progress [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. labels Nov 10, 2022
@nateweller nateweller requested a review from a team November 10, 2022 17:22
@nateweller nateweller self-assigned this Nov 10, 2022
@nateweller nateweller changed the base branch from trunk to add/scan-in-protect November 10, 2022 17:22
@github-actions
Copy link
Contributor

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

@nateweller nateweller force-pushed the fix/protect-plan-check branch 2 times, most recently from 0c8cb60 to 43569b7 Compare November 14, 2022 19:15
@nateweller nateweller marked this pull request as ready for review November 15, 2022 20:13
@nateweller nateweller added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Nov 15, 2022
@github-actions github-actions bot added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Nov 15, 2022
@nateweller nateweller removed 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 15, 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 15, 2022
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.

This is a major improvement - awesome work!

@nateweller nateweller merged commit ddceeae into add/scan-in-protect Nov 16, 2022
@nateweller nateweller deleted the fix/protect-plan-check branch November 16, 2022 05:42
@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 Nov 16, 2022
@nateweller nateweller mentioned this pull request Nov 16, 2022
2 tasks
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. [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants