diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-03-10 22:32:29 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-03-10 22:32:29 +0100 |
commit | dc6789fd5bf4ef537a543fcafc90070265a8ee7c (patch) | |
tree | 0b7e4aaf938a351ecb8903219ba82fcd5b33512c /tests | |
parent | b502667f3a5e6f08fb2fefbac56134d074859c09 (diff) | |
download | nextcloud-server-dc6789fd5bf4ef537a543fcafc90070265a8ee7c.tar.gz nextcloud-server-dc6789fd5bf4ef537a543fcafc90070265a8ee7c.zip |
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 'tests')
-rw-r--r-- | tests/lib/security/trusteddomainhelper.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/lib/security/trusteddomainhelper.php b/tests/lib/security/trusteddomainhelper.php index 52a8f1be630..3581211ce61 100644 --- a/tests/lib/security/trusteddomainhelper.php +++ b/tests/lib/security/trusteddomainhelper.php @@ -42,7 +42,12 @@ class TrustedDomainHelperTest extends \Test\TestCase { * @return array */ public function trustedDomainDataProvider() { - $trustedHostTestList = ['host.one.test', 'host.two.test', '[1fff:0:a88:85a3::ac1f]']; + $trustedHostTestList = [ + 'host.one.test', + 'host.two.test', + '[1fff:0:a88:85a3::ac1f]', + 'host.three.test:443', + ]; return [ // empty defaults to false with 8.1 [null, 'host.one.test:8080', false], @@ -56,6 +61,9 @@ class TrustedDomainHelperTest extends \Test\TestCase { [$trustedHostTestList, '[1fff:0:a88:85a3::ac1f]', true], [$trustedHostTestList, '[1fff:0:a88:85a3::ac1f]:801', true], [$trustedHostTestList, '[1fff:0:a88:85a3::ac1f]:801:34', false], + [$trustedHostTestList, 'host.three.test:443', true], + [$trustedHostTestList, 'host.three.test:80', false], + [$trustedHostTestList, 'host.three.test', false], // trust localhost regardless of trust list [$trustedHostTestList, 'localhost', true], [$trustedHostTestList, 'localhost:8080', true], |