diff options
author | Joas Schilling <coding@schilljs.com> | 2023-12-04 10:38:46 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-12-07 06:39:34 +0100 |
commit | 6b895462ac12c72555981120a85c2fe6c5a9df06 (patch) | |
tree | bfe6aa1213c05d0ddd59b60c30cd591bc78043d5 /tests | |
parent | 84af629fa598b340c089c023db665238aee00c38 (diff) | |
download | nextcloud-server-6b895462ac12c72555981120a85c2fe6c5a9df06.tar.gz nextcloud-server-6b895462ac12c72555981120a85c2fe6c5a9df06.zip |
fix(security): Handle idn_to_utf8 returning false
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Http/Client/ClientTest.php | 1 | ||||
-rw-r--r-- | tests/lib/Security/RemoteHostValidatorTest.php | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php index e48e237e0cc..4d937b6c0f2 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -148,6 +148,7 @@ class ClientTest extends \Test\TestCase { ['https://service.localhost'], ['!@#$', true], // test invalid url ['https://normal.host.com'], + ['https://com.one-.nextcloud-one.com'], ]; } diff --git a/tests/lib/Security/RemoteHostValidatorTest.php b/tests/lib/Security/RemoteHostValidatorTest.php index 030a75b1e79..b1371d9343c 100644 --- a/tests/lib/Security/RemoteHostValidatorTest.php +++ b/tests/lib/Security/RemoteHostValidatorTest.php @@ -60,8 +60,17 @@ class RemoteHostValidatorTest extends TestCase { ); } - public function testValid(): void { - $host = 'nextcloud.com'; + public function dataValid(): array { + return [ + ['nextcloud.com', true], + ['com.one-.nextcloud-one.com', false], + ]; + } + + /** + * @dataProvider dataValid + */ + public function testValid(string $host, bool $expected): void { $this->hostnameClassifier ->method('isLocalHostname') ->with($host) @@ -73,7 +82,7 @@ class RemoteHostValidatorTest extends TestCase { $valid = $this->validator->isValid($host); - self::assertTrue($valid); + self::assertSame($expected, $valid); } public function testLocalHostname(): void { |