From 7087b78718a64185ea1ebaf615f4a8b395f39267 Mon Sep 17 00:00:00 2001 From: Shaswat Ganisshan Date: Mon, 4 Mar 2024 16:15:05 -0500 Subject: [PATCH] Fixed issue where invalid github usernames generate invalid ssh keys. --- webroot/panel/account.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webroot/panel/account.php b/webroot/panel/account.php index 70bd098..c45602c 100644 --- a/webroot/panel/account.php +++ b/webroot/panel/account.php @@ -38,8 +38,15 @@ break; case "github": $gh_user = $_POST["gh_user"]; + if (empty($gh_user)) { + break; + } $keys = UnitySite::getGithubKeys($gh_user); - $added_keys = $keys; + foreach ($keys as $key) { + if (UnitySite::testValidSSHKey($key)) { + array_push($added_keys, $key); + } + } break; }