updated core to 7.79
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* The current system version.
|
||||
*/
|
||||
define('VERSION', '7.58');
|
||||
define('VERSION', '7.59');
|
||||
|
||||
/**
|
||||
* Core API compatibility.
|
||||
@@ -2778,6 +2778,11 @@ function _drupal_bootstrap_variables() {
|
||||
unset($_GET['destination']);
|
||||
unset($_REQUEST['destination']);
|
||||
}
|
||||
// Use the DrupalRequestSanitizer to ensure that the destination's query
|
||||
// parameters are not dangerous.
|
||||
if (isset($_GET['destination'])) {
|
||||
DrupalRequestSanitizer::cleanDestination();
|
||||
}
|
||||
// If there's still something in $_REQUEST['destination'] that didn't come
|
||||
// from $_GET, check it too.
|
||||
if (isset($_REQUEST['destination']) && (!isset($_GET['destination']) || $_REQUEST['destination'] != $_GET['destination']) && url_is_external($_REQUEST['destination'])) {
|
||||
|
@@ -611,8 +611,9 @@ function drupal_parse_url($url) {
|
||||
}
|
||||
// The 'q' parameter contains the path of the current page if clean URLs are
|
||||
// disabled. It overrides the 'path' of the URL when present, even if clean
|
||||
// URLs are enabled, due to how Apache rewriting rules work.
|
||||
if (isset($options['query']['q'])) {
|
||||
// URLs are enabled, due to how Apache rewriting rules work. The path
|
||||
// parameter must be a string.
|
||||
if (isset($options['query']['q']) && is_string($options['query']['q'])) {
|
||||
$options['path'] = $options['query']['q'];
|
||||
unset($options['query']['q']);
|
||||
}
|
||||
|
@@ -51,6 +51,38 @@ class DrupalRequestSanitizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the destination if it is dangerous.
|
||||
*
|
||||
* Note this can only be called after common.inc has been included.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the destination has been removed from $_GET, FALSE if not.
|
||||
*/
|
||||
public static function cleanDestination() {
|
||||
$dangerous_keys = array();
|
||||
$log_sanitized_keys = variable_get('sanitize_input_logging', FALSE);
|
||||
|
||||
$parts = drupal_parse_url($_GET['destination']);
|
||||
// If there is a query string, check its query parameters.
|
||||
if (!empty($parts['query'])) {
|
||||
$whitelist = variable_get('sanitize_input_whitelist', array());
|
||||
|
||||
self::stripDangerousValues($parts['query'], $whitelist, $dangerous_keys);
|
||||
if (!empty($dangerous_keys)) {
|
||||
// The destination is removed rather than sanitized to mirror the
|
||||
// handling of external destinations.
|
||||
unset($_GET['destination']);
|
||||
unset($_REQUEST['destination']);
|
||||
if ($log_sanitized_keys) {
|
||||
trigger_error(format_string('Potentially unsafe destination removed from query string parameters (GET) because it contained the following keys: @keys', array('@keys' => implode(', ', $dangerous_keys))));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips dangerous keys from the provided input.
|
||||
*
|
||||
|
Reference in New Issue
Block a user