From d8b569b56469ab406756de6f1bdecc543031c932 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 10 Jul 2026 18:19:13 +0530 Subject: [PATCH] Fix empty database lists for Console OAuth tokens without admin mode (#12839) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix OAuth owner tokens leaving document auth enabled without admin mode Console OAuth bearer tokens (CLI/MCP) never sent X-Appwrite-Mode: admin, so document authorization stayed on and databases without $permissions listed empty. Co-authored-by: Cursor * Improve quality * All admin mode patch occurances * Do not run project READ check for OAuth owner keys OAuth owner tokens skip the admin membership role-loading branch, so the project READ safety net false-negatives with PROJECT_NOT_FOUND. Keep the auth bypass without admin mode; ownership is enforced at grant time. Co-authored-by: Cursor * Rely on normalized admin mode for OAuth owner requests Keep OAuth-specific classification at the request boundary and limit the shared API change to skipping the session-only project permission check. Co-authored-by: Cursor --------- Co-authored-by: Cursor Co-authored-by: Matej Bačo --- app/controllers/shared/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 359c5e0a5b..baad8ff7ba 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -369,7 +369,7 @@ Http::init() * But, for actions on resources (sites, functions, etc.) in a non-console project, we explicitly check * whether the admin user has necessary permission on the project (sites, functions, etc. don't have permissions associated to them). */ - if ($isAdminProjectRequest && (empty($apiKey) || $isOAuthAdminKey)) { + if ($isAdminProjectRequest && empty($apiKey)) { $input = new Input(Database::PERMISSION_READ, $project->getPermissionsByType(Database::PERMISSION_READ)); $initialStatus = $authorization->getStatus(); $authorization->enable();