diff options
author | Joas Schilling <coding@schilljs.com> | 2023-12-04 10:38:46 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-12-04 11:18:51 +0000 |
commit | 704751f86831621dec1da588e0b62f815831d55c (patch) | |
tree | 6d32a918575aa863a5a361123de53fbd9b936e8b /tests | |
parent | 0744821ebfa2ac66299d44390a7d1027fbda679d (diff) | |
download | nextcloud-server-704751f86831621dec1da588e0b62f815831d55c.tar.gz nextcloud-server-704751f86831621dec1da588e0b62f815831d55c.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 3cef9d75986..0e6e265584e 100644 --- a/tests/lib/Http/Client/ClientTest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -149,6 +149,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 { |