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

My Jetpack: Add a Protect 'needs-attention' status when Threats are detected. #40628

Open
wants to merge 37 commits into
base: trunk
Choose a base branch
from

Conversation

elliottprogrammer
Copy link
Contributor

@elliottprogrammer elliottprogrammer commented Dec 16, 2024

This PR adds a 'needs-attention' status to the Protect product card in My Jetpack when Protect threats are detected.
The Primary CTA changes to "Fix threats".
The 'needs-attention' status itself is actually hidden in the sense that the status still remains as "Active", however the product card border will either be yellow or red

With Threats With Critical Threats
Screen Shot 2024-12-16 at 09 05 01 Screen Shot on 2024-12-16 at 09-07-07

Fixes https://github.com/Automattic/jetpack-roadmap/issues/1939

Proposed changes:

  • I split the needs_attention status into 2 separate statuses (needs-attention__warning & needs-attention__error)
  • When Protect detects threats, the protect card has yellow border (needs-attention__warning), if there are Critical threats, Protect has a red border (needs-attention__error).
  • If threats are detected, the Protect CTA is "Fix threats".

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

Project Thread: pbNhbs-bJN-p2
Design post: p1HpG7-umC-p2

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

Testing instructions:

  • Install/activate Jetpack Protect with a Scan upgrade
  • Using the Scan Helper in the Jetpack Debug Helper/Tools plugin, select the first EIACAR Threats selection to Add five EICAR threats to the site (one for every severity).
  • Run a scan to detect them
  • Proceed to the My Jetpack section, scroll down to the Protect product card.
  • Verify the Protect product card has a red border, the CTA is "Fix threats" and the status appears as "Active".
  • Now, using the Scan Helper in the Jetpack Debug Helper/Tools plugin again, remove the first EIACAR Threats selection and add a different threat (like maybe a vulnerable plugin threat).
  • Now verify the Protect product card has a yellow border, the CTA is "Fix threats" and the status appears as "Active".

@elliottprogrammer elliottprogrammer self-assigned this Dec 16, 2024
@elliottprogrammer elliottprogrammer changed the base branch from trunk to add/backup-redbubble-needs-attention-notice December 16, 2024 14:15
Copy link
Contributor

github-actions bot commented Dec 16, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the add/protect-fix-threats-status branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/protect-fix-threats-status
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

Copy link
Contributor

github-actions bot commented Dec 16, 2024

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.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • 🔴 Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

Base automatically changed from add/backup-redbubble-needs-attention-notice to trunk December 19, 2024 05:01
@elliottprogrammer elliottprogrammer requested a review from a team December 20, 2024 08:38
@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 Dec 20, 2024
Copy link
Contributor

@robertsreberski robertsreberski left a comment

Choose a reason for hiding this comment

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

I have added one commit to fix minification issue with i18n. The code tests well after that!

I left some remarks, and the phan error should be addressed. Hope that will help move things further.

Comment on lines 50 to 53
if ( slug === 'protect' ) {
return __( 'Active', 'jetpack-my-jetpack' );
}
return __( 'Needs attention', 'jetpack-my-jetpack' );
Copy link
Contributor

Choose a reason for hiding this comment

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

I ask to understand more: are there no cases we need to actually display "Needs attention" in Protect card?

Copy link
Contributor

Choose a reason for hiding this comment

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

If so, I could make use of some comment here, cause it's a bit difficult to understand from the context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ask to understand more: are there no cases we need to actually display "Needs attention" in Protect card?

As I understand it, for the Protect card, even when it has a NEEDS_ATTENTION__{WARNING | ERROR} status (which means threats have been detected), we still want to show the card status as 'Active' (per the designs: v1IWiVmOAvI8yT8CCa4b1I-fi-4398_9423).
I believe this is to portray to the user that Protect is still operating correctly/normally as it should (however threats were detected).
I left a comment in the code (as you suggested) to explain there also.

@elliottprogrammer
Copy link
Contributor Author

I left some remarks, and the phan error should be addressed. Hope that will help move things further.

@robertsreberski, thanks very much for the review! Much appreciated! 🙌
I've addressed all feedback & suggestions. Also the Phan error.
I believe everything should be good now. Let me know what you think! 🙂

@elliottprogrammer elliottprogrammer 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 Dec 20, 2024
@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 Dec 20, 2024
@elliottprogrammer elliottprogrammer 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 Dec 20, 2024
@elliottprogrammer elliottprogrammer requested a review from a team December 20, 2024 21:39
@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 Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[JS Package] Components [Package] My Jetpack RNA [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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants