forked from AmazeeLabs/algm_drutiny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recent core vulnerability policies and file name changes
- Loading branch information
Tim Clifford
committed
Sep 18, 2020
1 parent
b76b745
commit 3bef4ce
Showing
13 changed files
with
199 additions
and
14 deletions.
There are no files selected for viewing
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,18 @@ | ||
title: "SA-CORE-2020-007" | ||
class: \Drutiny\algm\Audit\ModuleVersion | ||
name: Drupal-7:SA-CORE-2020-007 | ||
tags: | ||
- Drupal 7 | ||
- Security | ||
description: | | ||
Runs tests to check for SA-CORE-2020-007 (https://www.drupal.org/sa-core-2020-007). | ||
The Drupal AJAX API does not disable JSONP by default, which can lead to cross-site scripting. | ||
remediation: Upgrade Drupal 7 to 7.73 | ||
success: This site is secure from the vulnerabilities in SA-CORE-2020-007 | ||
failure: This sites current Drupal version {{current_version}} is not secure against SA-CORE-2020-007. | ||
parameters: | ||
module: | ||
default: system | ||
version: | ||
default: 7.73 |
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,20 @@ | ||
title: "SA-CORE-2020-009" | ||
class: \Drutiny\algm\Audit\D8_SA_CORE_2020_009 | ||
name: Drupal-8:SA-CORE-2020-009 | ||
tags: | ||
- Drupal 8 | ||
- Security | ||
description: | | ||
Runs tests to check for SA-CORE-2020-0079 (https://www.drupal.org/sa-core-2020-009). | ||
Core Drupal 8 reflected XSS vulnerability. | ||
remediation: | | ||
If you are using Drupal 8.8.x, upgrade to Drupal 8.8.10. | ||
If you are using Drupal 8.9.x, upgrade to Drupal 8.9.6. | ||
success: This site is secure from the vulnerabilities in SA-CORE-2020-009 | ||
failure: This sites current Drupal version {{current_version}} is not secure against SA-CORE-2020-009. | ||
parameters: | ||
module: | ||
default: system | ||
version: | ||
default: 8.9.6 |
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
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
7 changes: 4 additions & 3 deletions
7
Policies/D9_module_updates_scan.policy.yml → Policies/module_updates_status.policy.yml
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
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
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
2 changes: 1 addition & 1 deletion
2
Profiles/ALGMPerformance.profile.yml → Profiles/algm_performance.profile.yml
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
title: 'ALGM Performance' | ||
description: 'Site Performance Audit for ALGM.' | ||
policies: | ||
'ALGMPerformance:PSI': { } | ||
'algm:Performance:PSI': { } | ||
format: | ||
html: { template: page, content: [{ heading: Purpose, body: "This report is designed to provide some feedback on the overall health of\nthe web application by performing some deep dive analysis. The items\nsurfaced in the report can help improve performance and stability.\n" }, { heading: 'Reporting period', body: "Period | Date time\n------ | ---------\nStart | {{reporting_period_start}}\nEnd | {{reporting_period_end}}\n" }, { heading: Recommendations, body: "<ul>\n{{# remediations }}\n <li>{{{ . }}}</li>\n{{/ remediations }}\n</ul>\n" }, { heading: Findings, body: "{{{ severity_stats }}}\n### Issue Summary\n{{{ summary_table }}}\n\n{{#failures}}\n ### Issues\n {{# output_failure }}\n {{{.}}}\n {{/ output_failure }}\n{{/failures}}\n\n{{#warnings}}\n ### Warnings\n {{# output_warning }}\n {{{.}}}\n {{/ output_warning }}\n{{/warnings}}\n" }, { heading: Appendix, body: "{{#notices}}\n ### Appendix - Analysis\n\n The various appendices provides more detailed data regarding the health of\n the site.\n\n {{# output_notice }}\n {{{.}}}\n {{/ output_notice }}\n{{/notices}}\n\n{{#errors}}\n ### Appendix - Errors\n\n During the production of this report, not all report policies were able to\n be carried out due to errors encounted.\n\n {{#output_error}}\n {{{.}}}\n {{/output_error}}\n{{/errors}}\n\n### Appendix - Summary\nThe below table describes all audit and analysis work completed for the\nproduction of this report and their associated outcomes.\n\n{{{ appendix_table }}}\n\n{{#passes}}\n### Appendix - Successful Assessments\n{{# output_success }}\n {{{.}}}\n{{/ output_success }}\n{{/passes}}\n" }] } |
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
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,83 @@ | ||
<?php | ||
|
||
namespace Drutiny\algm\Audit; | ||
|
||
use Drutiny\Audit; | ||
use Drutiny\Sandbox\Sandbox; | ||
use Drutiny\Annotation\Param; | ||
use Exception; | ||
|
||
/** | ||
* Check the version of Drupal project in a site. | ||
* | ||
* @Param( | ||
* name = "module", | ||
* description = "The module to version information for", | ||
* type = "string" | ||
* ) | ||
* @Param( | ||
* name = "version", | ||
* description = "The static version to check against.", | ||
* type = "string" | ||
* ) | ||
* @Param( | ||
* name = "comparator", | ||
* description = "How to compare the version (greaterThan, greaterThanOrEqualTo, lessThan etc. See https://github.com/composer/semver)", | ||
* type = "string", | ||
* default = "greaterThanOrEqualTo" | ||
* ) | ||
*/ | ||
class D8_SA_CORE_2020_009 extends Audit { | ||
|
||
public function audit(Sandbox $sandbox) | ||
{ | ||
$module = $sandbox->getParameter('module'); | ||
$version = $sandbox->getParameter('version'); | ||
$comparator_method = $sandbox->getParameter('comparator'); | ||
|
||
// Check for presence of patch | ||
try { | ||
$find_patch = trim($sandbox->exec('find . -name FormBuilder.php -exec grep "filterBadProtocol" {} \;')); | ||
} | ||
catch (Exception $e) { | ||
throw new \Exception("Failed to run find"); | ||
return Audit::ERROR; | ||
} | ||
|
||
if ($find_patch !== '') { | ||
return Audit::SUCCESS; | ||
} | ||
|
||
if (!method_exists("Composer\Semver\Comparator", $comparator_method)) { | ||
throw new \Exception("Comparator method not available: $comparator_method"); | ||
} | ||
|
||
try { | ||
$info = $sandbox->drush(['format' => 'json'])->pmList(); | ||
} | ||
catch (Exception $e) { | ||
throw new \Exception("Drush command failed"); | ||
return Audit::ERROR; | ||
} | ||
|
||
|
||
if (!isset($info[$module])) { | ||
return Audit::NOT_APPLICABLE; | ||
} | ||
|
||
$current_version = strtolower($info[$module]['version']); | ||
$sandbox->setParameter('current_version', $current_version); | ||
|
||
if (substr($current_version, 0, 3 ) === "8.8") { | ||
return call_user_func("Composer\Semver\Comparator::$comparator_method", $current_version, "8.8.10"); | ||
} | ||
|
||
if (substr($current_version, 0, 3 ) === "8.9") { | ||
return call_user_func("Composer\Semver\Comparator::$comparator_method", $current_version, "8.9.6"); | ||
} | ||
|
||
$sandbox->logger()->info("$comparator_method($current_version, $version)"); | ||
|
||
return call_user_func("Composer\Semver\Comparator::$comparator_method", $current_version, $version); | ||
} | ||
} |
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
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,62 @@ | ||
<?php | ||
|
||
namespace Drutiny\algm\Audit; | ||
|
||
use Drutiny\Audit; | ||
use Drutiny\Sandbox\Sandbox; | ||
use Drutiny\Annotation\Param; | ||
use Exception; | ||
|
||
/** | ||
* Check the version of Drupal core or a module in a site. | ||
* | ||
* @Param( | ||
* name = "module", | ||
* description = "The module to version information for", | ||
* type = "string" | ||
* ) | ||
* @Param( | ||
* name = "version", | ||
* description = "The static version to check against.", | ||
* type = "string" | ||
* ) | ||
* @Param( | ||
* name = "comparator", | ||
* description = "How to compare the version (greaterThan, greaterThanOrEqualTo, lessThan etc. See https://github.com/composer/semver)", | ||
* type = "string", | ||
* default = "greaterThanOrEqualTo" | ||
* ) | ||
*/ | ||
class ModuleVersion extends Audit { | ||
|
||
public function audit(Sandbox $sandbox) | ||
{ | ||
$module = $sandbox->getParameter('module'); | ||
$version = $sandbox->getParameter('version'); | ||
$comparator_method = $sandbox->getParameter('comparator'); | ||
|
||
if (!method_exists("Composer\Semver\Comparator", $comparator_method)) { | ||
throw new \Exception("Comparator method not available: $comparator_method"); | ||
} | ||
|
||
try { | ||
$info = $sandbox->drush(['format' => 'json'])->pmList(); | ||
} | ||
catch (Exception $e) { | ||
throw new \Exception("Drush command failed: " . $e); | ||
return Audit::ERROR; | ||
} | ||
|
||
|
||
if (!isset($info[$module])) { | ||
return Audit::NOT_APPLICABLE; | ||
} | ||
|
||
$current_version = strtolower($info[$module]['version']); | ||
$sandbox->setParameter('current_version', $current_version); | ||
|
||
$sandbox->logger()->info("$comparator_method($current_version, $version)"); | ||
|
||
return call_user_func("Composer\Semver\Comparator::$comparator_method", $current_version, $version); | ||
} | ||
} |
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