mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Less strict checks for relative URL normalization in SS_HTTPRequest (regression from recent security fixes to Director::is_absolute_url()) (fixes #7359)
This commit is contained in:
parent
18fa9cd03d
commit
fedb337aa5
@ -90,8 +90,9 @@ class SS_HTTPRequest implements ArrayAccess {
|
|||||||
function __construct($httpMethod, $url, $getVars = array(), $postVars = array(), $body = null) {
|
function __construct($httpMethod, $url, $getVars = array(), $postVars = array(), $body = null) {
|
||||||
$this->httpMethod = strtoupper(self::detect_method($httpMethod, $postVars));
|
$this->httpMethod = strtoupper(self::detect_method($httpMethod, $postVars));
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
if(Director::is_relative_url($url)) {
|
// Normalize URL if its relative (strictly speaking), or has leading slashes
|
||||||
|
if(Director::is_relative_url($url) || preg_match('/^\//', $url)) {
|
||||||
$this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'),array('/','',''), $this->url);
|
$this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'),array('/','',''), $this->url);
|
||||||
}
|
}
|
||||||
if(preg_match('/^(.*)\.([A-Za-z][A-Za-z0-9]*)$/', $this->url, $matches)) {
|
if(preg_match('/^(.*)\.([A-Za-z][A-Za-z0-9]*)$/', $this->url, $matches)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user