Skip to content

Commit 742265e

Browse files
authored
phpseclib is patched now (#404)
1 parent 90a94de commit 742265e

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

resources/lib/utils.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use UnityWebPortal\lib\exceptions\EncodingUnknownException;
66
use UnityWebPortal\lib\exceptions\EncodingConversionException;
77
use phpseclib3\Crypt\PublicKeyLoader;
8+
use phpseclib3\Exception\NoKeyLoadedException;
89

910
// like assert() but not subject to zend.assertions config
1011
function ensure(bool $condition, ?string $message = null): void
@@ -16,24 +17,10 @@ function ensure(bool $condition, ?string $message = null): void
1617

1718
function testValidSSHKey(string $key_str): bool
1819
{
19-
// key loader still throws, these just mute warnings for phpunit
20-
// https://github.com/phpseclib/phpseclib/issues/2079
21-
if ($key_str == "") {
22-
return false;
23-
}
24-
// https://github.com/phpseclib/phpseclib/issues/2076
25-
// https://github.com/phpseclib/phpseclib/issues/2077
26-
// there are actually valid JSON keys (JWK), but I don't think anybody uses it
27-
if (!is_null(@json_decode($key_str))) {
28-
return false;
29-
}
3020
try {
3121
PublicKeyLoader::load($key_str);
3222
return true;
33-
// phpseclib should throw only NoKeyLoadedException but that is not the case
34-
// https://github.com/phpseclib/phpseclib/pull/2078
35-
// } catch (\phpseclib3\Exception\NoKeyLoadedException $e) {
36-
} catch (\Throwable $e) {
23+
} catch (NoKeyLoadedException $e) {
3724
return false;
3825
}
3926
}

0 commit comments

Comments
 (0)