From c9273ac19cd6997c61acd699d363d76176ec0baa Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 14 Jul 2026 19:05:24 +0530 Subject: [PATCH] Move VCS-specific Gitea OAuth2 scopes to the call site The adapter class defaulted to the full repo/org/issue scope set, so any future "sign in with Gitea" feature reusing this OAuth2 class would force that same scope set on a plain login, which it doesn't need. Mirrors OAuth2\Github, whose adapter only defaults to 'user:email' -- the VCS authorize flow now passes its own required scopes via the constructor's existing $scopes parameter instead of the adapter hardcoding them. --- src/Appwrite/Auth/OAuth2/Gitea.php | 5 ----- .../Platform/Modules/VCS/Http/Gitea/Authorize/Get.php | 11 ++++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Gitea.php b/src/Appwrite/Auth/OAuth2/Gitea.php index 1cc891c167..390189fc72 100644 --- a/src/Appwrite/Auth/OAuth2/Gitea.php +++ b/src/Appwrite/Auth/OAuth2/Gitea.php @@ -14,11 +14,6 @@ class Gitea extends OAuth2 protected array $scopes = [ 'read:user', - 'read:repository', - 'write:repository', - 'read:organization', - 'read:issue', - 'write:issue', ]; public function setEndpoint(string $endpoint): void diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Gitea/Authorize/Get.php b/src/Appwrite/Platform/Modules/VCS/Http/Gitea/Authorize/Get.php index e77d2267ec..efeef8fc3a 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Gitea/Authorize/Get.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Gitea/Authorize/Get.php @@ -30,7 +30,16 @@ class Get extends Base System::getEnv('_APP_VCS_GITEA_CLIENT_ID', ''), System::getEnv('_APP_VCS_GITEA_CLIENT_SECRET', ''), $callback, - $state + $state, + // VCS-specific scopes -- the adapter's own default is just + // read:user, enough for a plain "sign in with Gitea". + [ + 'read:repository', + 'write:repository', + 'read:organization', + 'read:issue', + 'write:issue', + ] ); // The login page is opened by the browser, which may reach Gitea on a