diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-03-11 00:32:29 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-11 16:54:20 +0300 |
commit | 9bc99bb297578145d019ee51c0830044bbc84e7c (patch) | |
tree | 376534f9d26154656c3ed9c75374135366ed3073 /lib | |
parent | e3de44ea5192d29a43fffc23c83b58b750a5e85a (diff) |
Explicitly check for port
The setup uses `\OCP\IRequest::getInsecureServerHost` which in some cases can also include a port. This makes the trusted domain check fail thus.
I've decided to add this here that way because adjusting the setup would require parsing the host properly. This is not something that can be done very good in PHP. Check the following example for why `parse_url` is not our friend: https://3v4l.org/k501Z
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/security/trusteddomainhelper.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/security/trusteddomainhelper.php b/lib/private/security/trusteddomainhelper.php index 885ceee23c3..409628677a7 100644 --- a/lib/private/security/trusteddomainhelper.php +++ b/lib/private/security/trusteddomainhelper.php @@ -78,6 +78,12 @@ class TrustedDomainHelper { if (preg_match(Request::REGEX_LOCALHOST, $domain) === 1) { return true; } + + // Compare with port appended + if(in_array($domainWithPort, $trustedList, true)) { + return true; + } + return in_array($domain, $trustedList, true); } |