Require explicit endpoint + apiKey for external Appwrite sources

This commit is contained in:
Prem Palanisamy
2026-05-22 07:16:18 +01:00
parent cbf2fd6e6a
commit 507f9d6c6c
@@ -214,6 +214,13 @@ class Migrations extends Action
throw new Exception(Exception::MIGRATION_SOURCE_PROJECT_NOT_FOUND);
}
$projectDB = call_user_func($this->getProjectDB, $this->sourceProject);
} elseif ($this->sourceProject->isEmpty()) {
// External source — processMigration defaults missing endpoint/apiKey to this
// instance, which would silently self-call with the destination's key. Require
// explicit credentials so the failure mode is clear.
if (empty($credentials['endpoint']) || empty($credentials['apiKey'])) {
throw new Exception(Exception::MIGRATION_SOURCE_PROJECT_NOT_FOUND);
}
}
}
$getDatabasesDB = fn (Document $database): Database =>