From 752b274c0c065bb5710d0947ca4a017e039501fd Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 15 Jul 2026 17:48:23 +0530 Subject: [PATCH] Scope GitHub App installation queries by provider Both share the installations collection with Gitea now. Without a provider filter, a numeric providerInstallationId collision between a GitHub App installation and a Gitea installation (for the same project, or across projects for the installation.deleted handler) would silently match the wrong document -- overwriting a Gitea installation on callback, or deleting one along with its connected functions/sites/repositories on installation.deleted. --- src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php | 3 ++- .../Platform/Modules/VCS/Http/GitHub/Events/Create.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php index 4bd10c3885..76bcd4d8ea 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php @@ -111,7 +111,8 @@ class Get extends Action $installation = $dbForPlatform->findOne('installations', [ Query::equal('providerInstallationId', [$providerInstallationId]), - Query::equal('projectInternalId', [$projectInternalId]) + Query::equal('projectInternalId', [$projectInternalId]), + Query::equal('provider', ['github']) ]); $personal = false; diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index 9e48159505..7bd23d285d 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -113,6 +113,7 @@ class Create extends Action do { $installationQueries = [ Query::equal('providerInstallationId', [$providerInstallationId]), + Query::equal('provider', ['github']), Query::limit(1000), ]; if ($installationCursor !== null) {