From 47d07dd10820ee0b2f8bff35af4f026719337623 Mon Sep 17 00:00:00 2001 From: cubic Date: Thu, 31 Mar 2022 17:00:10 +0800 Subject: [PATCH 1/3] fix(install script): use chwon set logs --- misc/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/install.sh b/misc/install.sh index 2d24af9..b16a4bd 100644 --- a/misc/install.sh +++ b/misc/install.sh @@ -40,7 +40,7 @@ chmod 0777 ../config.yaml ../env.yaml echo 'env files generated!' mkdir ../application/logs -chmod -R git:git ../application/logs +chown -R git:git ../application/logs chmod -R 0777 ../git-storage From bf15997499a1a4a2d1e69868e6d392fe0d3c0b1b Mon Sep 17 00:00:00 2001 From: cubic Date: Thu, 31 Mar 2022 17:01:42 +0800 Subject: [PATCH 2/3] fix(Gateway Auth): cast numberic value to string value when compare gateway token (github: #77) github #77 --- application/libraries/service/AccessControl/APIAuth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/service/AccessControl/APIAuth.php b/application/libraries/service/AccessControl/APIAuth.php index 90a67a5..1acf176 100755 --- a/application/libraries/service/AccessControl/APIAuth.php +++ b/application/libraries/service/AccessControl/APIAuth.php @@ -15,7 +15,7 @@ class APIAuth static function auth(array $authTypes) { if (in_array(self::AUTH_TYPE_GATEWAY, $authTypes)) { - if (Request::parse()->token === YAML_GATEWAY_TOKEN) { + if ((string) Request::parse()->token === YAML_GATEWAY_TOKEN) { Request::setAuthData([]); return TRUE; } From 1dd04a4d18ba37a7d2bc600184c5107565731fce Mon Sep 17 00:00:00 2001 From: cubic Date: Thu, 31 Mar 2022 17:02:39 +0800 Subject: [PATCH 3/3] fix(Auth HTTP / SSH): remove useless slashes in regexp --- application/controllers/apiv1/internal.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/controllers/apiv1/internal.php b/application/controllers/apiv1/internal.php index bff11b6..6b7ded6 100755 --- a/application/controllers/apiv1/internal.php +++ b/application/controllers/apiv1/internal.php @@ -40,7 +40,7 @@ class Internal extends Base $data = Request::parse()->parsed; $parsedRepo = []; - preg_match("/([\w\d\_]+)\/([\w\d\_]+)\.git/", $data['repo'], $parsedRepo); + preg_match("/([\w\d_]+)\/([\w\d_]+)\.git/", $data['repo'], $parsedRepo); if ($data && $data['userID'] && $data['repo'] && $data['action'] && $parsedRepo[0] && $parsedRepo[1]) { @@ -74,6 +74,7 @@ class Internal extends Base // group or repository not found Response::reject(0x0302); } + Response::reject(0x0201); } @@ -81,7 +82,7 @@ class Internal extends Base $data = Request::parse()->parsed; $parsedRepo = []; - preg_match("/([\w\d\_]+)\/([\w\d\_]+)\.git/", $data['repo'], $parsedRepo); + preg_match("/([\w\d_]+)\/([\w\d_]+)\.git/", $data['repo'], $parsedRepo); if ($data && $data['user'] && $data['pass'] && $data['repo'] && $parsedRepo[1] && $parsedRepo[2]) { // check email and password @@ -134,6 +135,7 @@ class Internal extends Base // user not found Response::reject(0x0101); } + Response::reject(0x0201); }