-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine multiple vulnerabilities for a single extension into one vuln…
…erable extension threat changelog minor adjustments changelog add source to generator minor adjustments Add typed params minor adjustments use generator for core vulns threat
- Loading branch information
1 parent
8cb89d6
commit 51ecb63
Showing
5 changed files
with
216 additions
and
28 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ects/packages/protect-models/changelog/protect-status-combine-vulns-into-extension-threat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
projects/packages/protect-models/src/class-vulnerability-model.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/** | ||
* Model class for vulnerability data. | ||
* | ||
* @package automattic/jetpack-protect-models | ||
*/ | ||
|
||
namespace Automattic\Jetpack\Protect_Models; | ||
|
||
use Automattic\Jetpack\Redirect; | ||
|
||
/** | ||
* Model class for vulnerability data. | ||
*/ | ||
class Vulnerability_Model { | ||
/** | ||
* Threat ID. | ||
* | ||
* @var null|string | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* Threat Title. | ||
* | ||
* @var null|string | ||
*/ | ||
public $title; | ||
|
||
/** | ||
* Threat Description. | ||
* | ||
* @var null|string | ||
*/ | ||
public $description; | ||
|
||
/** | ||
* The version the threat is fixed in. | ||
* | ||
* @var null|string | ||
*/ | ||
public $fixed_in; | ||
|
||
/** | ||
* The version the threat was introduced. | ||
* | ||
* @var null|string | ||
*/ | ||
public $introduced_in; | ||
|
||
/** | ||
* The type of threat. | ||
* | ||
* @var null|string | ||
*/ | ||
public $type; | ||
|
||
/** | ||
* The source URL for the threat. | ||
* | ||
* @var null|string | ||
*/ | ||
public $source; | ||
|
||
/** | ||
* Threat Constructor | ||
* | ||
* @param array|object $threat Threat data to load into the class instance. | ||
*/ | ||
public function __construct( $threat ) { | ||
// Initialize the threat data. | ||
foreach ( $threat as $property => $value ) { | ||
if ( property_exists( $this, $property ) ) { | ||
$this->$property = $value; | ||
} | ||
} | ||
|
||
// Ensure the source URL is set. | ||
$this->get_source(); | ||
} | ||
|
||
/** | ||
* Get the source URL for the threat. | ||
* | ||
* @return string | ||
*/ | ||
public function get_source() { | ||
if ( empty( $this->source ) && $this->id ) { | ||
$this->source = Redirect::get_url( 'jetpack-protect-vul-info', array( 'path' => $this->id ) ); | ||
} | ||
|
||
return $this->source; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
projects/packages/protect-status/changelog/combine-vulns-into-threat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Combine multiple vulnerability results for the same extension into a single vulnerable extension threat result. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters