summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-07-07 19:34:11 +0200
committerGitHub <noreply@github.com>2016-07-07 19:34:11 +0200
commitc8ba8f637eb04f70cde45c5051e7e78c0ab24026 (patch)
tree598d46eec148647d4d609b19a974c9b3d18d304e /tests
parent2a1a3957b65e847d51c4c735acf033f7df29cba6 (diff)
parentc2309f1bcd5469e44fb5902bc62b55f439deba52 (diff)
downloadnextcloud-server-c8ba8f637eb04f70cde45c5051e7e78c0ab24026.tar.gz
nextcloud-server-c8ba8f637eb04f70cde45c5051e7e78c0ab24026.zip
Merge pull request #314 from jernst/master
Allow wildcard * to be used in trusted domains
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index dfd51167cca..1beb7a66717 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -49,6 +49,11 @@ class TrustedDomainHelperTest extends \Test\TestCase {
'host.two.test',
'[1fff:0:a88:85a3::ac1f]',
'host.three.test:443',
+ '*.leading.host',
+ 'trailing.host*',
+ 'cen*ter',
+ '*.leadingwith.port:123',
+ 'trailingwith.port*:456',
];
return [
// empty defaults to false with 8.1
@@ -76,7 +81,31 @@ class TrustedDomainHelperTest extends \Test\TestCase {
[$trustedHostTestList, 'localhost: evil.host', false],
// do not trust casting
[[1], '1', false],
+ // leading *
+ [$trustedHostTestList, 'abc.leading.host', true],
+ [$trustedHostTestList, 'abc.def.leading.host', true],
+ [$trustedHostTestList, 'abc.def.leading.host.another', false],
+ [$trustedHostTestList, 'abc.def.leading.host:123', true],
+ [$trustedHostTestList, 'leading.host', false],
+ // trailing *
+ [$trustedHostTestList, 'trailing.host', true],
+ [$trustedHostTestList, 'trailing.host.abc', true],
+ [$trustedHostTestList, 'trailing.host.abc.def', true],
+ [$trustedHostTestList, 'trailing.host.abc:123', true],
+ [$trustedHostTestList, 'another.trailing.host', false],
+ // center *
+ [$trustedHostTestList, 'center', true],
+ [$trustedHostTestList, 'cenxxxter', true],
+ [$trustedHostTestList, 'cen.x.y.ter', true],
+ // with port
+ [$trustedHostTestList, 'abc.leadingwith.port:123', true],
+ [$trustedHostTestList, 'abc.leadingwith.port:1234', false],
+ [$trustedHostTestList, 'trailingwith.port.abc:456', true],
+ [$trustedHostTestList, 'trailingwith.port.abc:123', false],
+ // bad hostname
+ [$trustedHostTestList, '-bad', false],
+ [$trustedHostTestList, '-bad.leading.host', false],
+ [$trustedHostTestList, 'bad..der.leading.host', false],
];
}
-
}