jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Protect: Formalize status, extension, and threat data with model classes

Open nateweller opened this issue 1 year ago • 1 comments

[In Progress]

The intention of this pull request is to add defined structure to how we store and interact with Protect report data, primarily by adding new model classes:

  • Status_Model: the entire status report as a whole.
  • Extension_Model: plugin, theme, or core data.
  • Threat_Model: generic model for plugin, theme, and core threats and vulnerabilities,

This is a preparatory step taken prior to introducing the Scan API as an alternate data source.

Changes proposed in this Pull Request:

  • Adds new /models directory with definitions for Status_Model, Extension_Model, and Threat_Model.
  • Integrates new model classes into the loading and implementation of Protect Report data, primarily in class-status.php. The generic normalize_report_data() method is replaced with a data-source specific load_data_from_protect_report() method, which is quite similar but more specific in how each property is mapped into the new Status_Model class.
  • Updates existing tests to expect model instances to be returned in the status.

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-1202717789119448/f

pbuNQi-3pv-p2

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

No

Testing instructions:

  • Run through the installation process on a fresh site with Jetpack Protect, ensuring that the waiting for results, results with no vulnerabilities, and results with vulnerabilities have no regression issues.

nateweller avatar Aug 10 '22 00:08 nateweller

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • :white_check_mark: Include a description of your PR changes.
  • :warning: All commits were linted before commit.
  • :white_check_mark: Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • :white_check_mark: Add testing instructions.
  • :white_check_mark: Specify whether this PR includes any changes to data or privacy.
  • :white_check_mark: 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 :robot:


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.


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.


Debug Helper plugin:

  • Next scheduled release: October 4, 2022.
  • Scheduled code freeze: September 26, 2022.

Protect plugin:

  • Next scheduled release: October 4, 2022.
  • Scheduled code freeze: September 26, 2022.

github-actions[bot] avatar Aug 10 '22 16:08 github-actions[bot]