Skip to content

Commit 81a4a21

Browse files
committed
add comments, try out removing digits check
1 parent b2a94be commit 81a4a21

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

resources/lib/UnitySite.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,26 @@ public static function getGithubKeys($username)
5252

5353
public static function testValidSSHKey($key_str)
5454
{
55-
// https://github.com/phpseclib/phpseclib/issues/2077
56-
// key loader still throws exception, this just mutes a warning for phpunit
57-
if (preg_match("/^[0-9]+$/", $key_str)) {
55+
// key loader still throws, these just mute warnings for phpunit
56+
// https://github.com/phpseclib/phpseclib/issues/2079
57+
if ($key_str == "") {
5858
return false;
5959
}
60+
// https://github.com/phpseclib/phpseclib/issues/2077
61+
// if (preg_match("/^[0-9]+$/", $key_str)) {
62+
// return false;
63+
// }
6064
// https://github.com/phpseclib/phpseclib/issues/2076
61-
// key loader still throws exception, this just mutes a warning for phpunit
65+
// there are actually valid JSON keys (JWK), but I don't think anybody uses it
6266
if (!is_null(@json_decode($key_str))) {
6367
return false;
6468
}
6569
try {
6670
PublicKeyLoader::load($key_str);
6771
return true;
72+
// phpseclib should throw only NoKeyLoadedException but that is not the case
73+
// https://github.com/phpseclib/phpseclib/pull/2078
74+
// } catch (\phpseclib3\Exception\NoKeyLoadedException $e) {
6875
} catch (\Throwable $e) {
6976
return false;
7077
}

0 commit comments

Comments
 (0)