Allow SSH keys for only "/"

This commit is contained in:
Miraty 2023-11-16 21:29:37 +01:00
parent 18fa6d794a
commit 808de3fdbf
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ foreach ($_POST['keys'] as $i => $key) {
unset($_POST['keys'][$i]);
continue;
}
if (preg_match('#^/[/\p{L}\{M}\p{N}\p{P}\p{S}\p{Zs}]{1,254}$#Du', $key['dir'] ?? '') !== 1)
if (preg_match('#^/[/\p{L}\{M}\p{N}\p{P}\p{S}\p{Zs}]{0,254}$#Du', $key['dir'] ?? '') !== 1)
output(403, _('Path is not valid.'));
if (preg_match('#' . ED25519_PUBKEY_REGEX . '#D', $key['public-key']) !== 1)
output(403, _('Ed25519 public key seems wrongly formatted.'));