From c1bd493fbea286836675458c9f797a886a84f834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 23 Jun 2025 11:28:18 +0200 Subject: [PATCH 01/10] Move refferer to resource; re-use in OPTIONS; re-use in platform check --- app/controllers/general.php | 50 +++++++----------------------------- app/init/resources.php | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 61a9cc9bfa..a47ae510fa 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -793,7 +793,6 @@ App::init() ->inject('getProjectDB') ->inject('locale') ->inject('localeCodes') - ->inject('clients') ->inject('geodb') ->inject('queueForStatsUsage') ->inject('queueForEvents') @@ -804,7 +803,9 @@ App::init() ->inject('previewHostname') ->inject('devKey') ->inject('apiKey') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey) { + ->inject('httpReferrer') + ->inject('httpReferrerSafe') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, string $httpReferrer, string $httpReferrerSafe) { /* * Appwrite Router */ @@ -936,42 +937,9 @@ App::init() $locale->setDefault($localeParam); } - $referrer = $request->getReferer(); - $origin = \parse_url($request->getOrigin($referrer), PHP_URL_HOST); - $protocol = \parse_url($request->getOrigin($referrer), PHP_URL_SCHEME); - $port = \parse_url($request->getOrigin($referrer), PHP_URL_PORT); - - $refDomainOrigin = 'localhost'; - $validator = new Hostname($clients); - if ($validator->isValid($origin)) { - $refDomainOrigin = $origin; - } elseif (!empty($origin)) { - // Auto-allow domains with linked rule - if (System::getEnv('_APP_RULES_FORMAT') === 'md5') { - $rule = Authorization::skip(fn () => $dbForPlatform->getDocument('rules', md5($origin ?? ''))); - } else { - $rule = Authorization::skip( - fn () => $dbForPlatform->find('rules', [ - Query::equal('domain', [$origin]), - Query::limit(1) - ]) - )[0] ?? new Document(); - } - - if (!$rule->isEmpty() && $rule->getAttribute('projectInternalId') === $project->getSequence()) { - $refDomainOrigin = $origin; - } - } - - $refDomain = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $refDomainOrigin . (!empty($port) ? ':' . $port : ''); - - $refDomain = (!$route->getLabel('origin', false)) // This route is publicly accessible - ? $refDomain - : (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); - + $origin = \parse_url($request->getOrigin($httpReferrer), PHP_URL_HOST); $selfDomain = new Domain($request->getHostname()); $endDomain = new Domain((string)$origin); - Config::setParam( 'domainVerification', ($selfDomain->getRegisterable() === $endDomain->getRegisterable()) && @@ -1043,7 +1011,7 @@ App::init() ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Dev-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent') ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies') - ->addHeader('Access-Control-Allow-Origin', $refDomain) + ->addHeader('Access-Control-Allow-Origin', $httpReferrerSafe) ->addHeader('Access-Control-Allow-Credentials', 'true'); if (!$devKey->isEmpty()) { @@ -1064,6 +1032,7 @@ App::init() && \in_array($request->getMethod(), [Request::METHOD_POST, Request::METHOD_PUT, Request::METHOD_PATCH, Request::METHOD_DELETE]) && $route->getLabel('origin', false) !== '*' && empty($request->getHeader('x-appwrite-key', '')) + && \parse_url($httpReferrerSafe, PHP_URL_HOST) === 'localhost' ) { throw new AppwriteException(AppwriteException::GENERAL_UNKNOWN_ORIGIN, $originValidator->getDescription()); } @@ -1086,7 +1055,8 @@ App::options() ->inject('project') ->inject('devKey') ->inject('apiKey') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey) { + ->inject('httpReferrerSafe') + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, string $httpReferrerSafe) { /* * Appwrite Router */ @@ -1099,14 +1069,12 @@ App::options() } } - $origin = $request->getOrigin(); - $response ->addHeader('Server', 'Appwrite') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Dev-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Appwrite-Session, X-Fallback-Cookies, X-Forwarded-For, X-Forwarded-User-Agent') ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies') - ->addHeader('Access-Control-Allow-Origin', $origin) + ->addHeader('Access-Control-Allow-Origin', $httpReferrerSafe) ->addHeader('Access-Control-Allow-Credentials', 'true') ->noContent(); diff --git a/app/init/resources.php b/app/init/resources.php index 5f65fe683f..eb77598adc 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -944,3 +944,54 @@ App::setResource('resourceToken', function ($project, $dbForProject, $request) { } return new Document([]); }, ['project', 'dbForProject', 'request']); + +App::setResource('httpReferrer', function (Request $request): string { + $referrer = $request->getReferer(); + return $referrer; +}, ['request']); + +App::setResource('httpReferrerSafe', function (Request $request, string $httpReferrer, array $clients, Database $dbForPlatform, Document $project, App $utopia): string { + $origin = \parse_url($request->getOrigin($httpReferrer), PHP_URL_HOST); + + // Safe if route is public + $route = $utopia->getRoute(); + if (!$route->getLabel('origin', false)) { + goto originToUrl; + } + + // Safe if added as web platform + $validator = new Hostname($clients); + if ($validator->isValid($origin)) { + goto originToUrl; + } + + // Safe if rule with same project ID exists + if (!empty($origin)) { + if (System::getEnv('_APP_RULES_FORMAT') === 'md5') { + $rule = Authorization::skip(fn () => $dbForPlatform->getDocument('rules', md5($origin ?? ''))); + } else { + $rule = Authorization::skip( + fn () => $dbForPlatform->find('rules', [ + Query::equal('domain', [$origin]), + Query::limit(1) + ]) + )[0] ?? new Document(); + } + + if (!$rule->isEmpty() && $rule->getAttribute('projectInternalId') === $project->getSequence()) { + goto originToUrl; + } + } + + // Unsafe; Localhost is always safe for ease of local development + $origin = 'localhost'; + + originToUrl: + + $protocol = \parse_url($request->getOrigin($httpReferrer), PHP_URL_SCHEME); + $port = \parse_url($request->getOrigin($httpReferrer), PHP_URL_PORT); + + $referrer = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); + + return $referrer; +}, ['request', 'httpReferrer', 'clients', 'dbForPlatform', 'project', 'utopia']); From b69ff36ddb2dc59d4699fd0a86d188c2513faaf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 23 Jun 2025 11:57:06 +0200 Subject: [PATCH 02/10] Manual QA fixes --- app/controllers/general.php | 7 ++++--- app/init/resources.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index a47ae510fa..3745a41c9a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1055,8 +1055,7 @@ App::options() ->inject('project') ->inject('devKey') ->inject('apiKey') - ->inject('httpReferrerSafe') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, string $httpReferrerSafe) { + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey) { /* * Appwrite Router */ @@ -1069,12 +1068,14 @@ App::options() } } + $origin = $request->getOrigin(); + $response ->addHeader('Server', 'Appwrite') ->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE') ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Dev-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Appwrite-Session, X-Fallback-Cookies, X-Forwarded-For, X-Forwarded-User-Agent') ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies') - ->addHeader('Access-Control-Allow-Origin', $httpReferrerSafe) + ->addHeader('Access-Control-Allow-Origin', $origin) ->addHeader('Access-Control-Allow-Credentials', 'true') ->noContent(); diff --git a/app/init/resources.php b/app/init/resources.php index eb77598adc..18203869df 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -953,9 +953,9 @@ App::setResource('httpReferrer', function (Request $request): string { App::setResource('httpReferrerSafe', function (Request $request, string $httpReferrer, array $clients, Database $dbForPlatform, Document $project, App $utopia): string { $origin = \parse_url($request->getOrigin($httpReferrer), PHP_URL_HOST); - // Safe if route is public + // Safe if route is publicly accessible $route = $utopia->getRoute(); - if (!$route->getLabel('origin', false)) { + if ($route->getLabel('origin', false)) { goto originToUrl; } From df82340daebd23bdb5c0c1931cf3a7793154bdc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 14:22:55 +0200 Subject: [PATCH 03/10] Improve code quality --- app/init/resources.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index 18203869df..aa04b46e1f 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -952,17 +952,20 @@ App::setResource('httpReferrer', function (Request $request): string { App::setResource('httpReferrerSafe', function (Request $request, string $httpReferrer, array $clients, Database $dbForPlatform, Document $project, App $utopia): string { $origin = \parse_url($request->getOrigin($httpReferrer), PHP_URL_HOST); + $protocol = \parse_url($request->getOrigin($httpReferrer), PHP_URL_SCHEME); + $port = \parse_url($request->getOrigin($httpReferrer), PHP_URL_PORT); + $referrer = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); // Safe if route is publicly accessible $route = $utopia->getRoute(); if ($route->getLabel('origin', false)) { - goto originToUrl; + return $referrer; } // Safe if added as web platform $validator = new Hostname($clients); if ($validator->isValid($origin)) { - goto originToUrl; + return $referrer; } // Safe if rule with same project ID exists @@ -979,19 +982,14 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef } if (!$rule->isEmpty() && $rule->getAttribute('projectInternalId') === $project->getSequence()) { - goto originToUrl; + return $referrer; } } // Unsafe; Localhost is always safe for ease of local development $origin = 'localhost'; - - originToUrl: - $protocol = \parse_url($request->getOrigin($httpReferrer), PHP_URL_SCHEME); $port = \parse_url($request->getOrigin($httpReferrer), PHP_URL_PORT); - $referrer = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); - return $referrer; }, ['request', 'httpReferrer', 'clients', 'dbForPlatform', 'project', 'utopia']); From f1590652cbe63085bfc2449898cefd242d6dbc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 14:30:50 +0200 Subject: [PATCH 04/10] Improve benchmark logging --- .github/workflows/benchmark.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6d73787d00..f9e86ce332 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -64,6 +64,7 @@ jobs: sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg sudo apt update sudo apt install oha + oha --version - name: Benchmark PR run: 'oha -z 180s http://localhost/v1/health/version -j > benchmark.json' - name: Cleaning From 4fff9b94f86daa378cd21317c90b52a45a862e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 14:45:58 +0200 Subject: [PATCH 05/10] Fix benchmark param name --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 2758eed90e..62b4953e27 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -66,7 +66,7 @@ jobs: sudo apt install oha oha --version - name: Benchmark PR - run: 'oha -z 180s http://localhost/v1/health/version --output_format json > benchmark.json' + run: 'oha -z 180s http://localhost/v1/health/version --output-format json > benchmark.json' - name: Cleaning run: docker compose down -v - name: Installing latest version @@ -79,7 +79,7 @@ jobs: docker compose up -d sleep 10 - name: Benchmark Latest - run: oha -z 180s http://localhost/v1/health/version --output_format json > benchmark-latest.json + run: oha -z 180s http://localhost/v1/health/version --output-format json > benchmark-latest.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt From 5a48fd6300c02940fa1dfb5ecf6d1b2a30e30562 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 27 Jun 2025 11:43:56 +0530 Subject: [PATCH 06/10] chore: update cli to 8.1.0 and add changelog --- app/config/platforms.php | 2 +- composer.json | 2 +- composer.lock | 65 +++++++++++++++++++------------------- docs/sdks/cli/CHANGELOG.md | 62 +++++++++++++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 35 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 63ad307ea2..96d5426515 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -217,7 +217,7 @@ return [ [ 'key' => 'cli', 'name' => 'Command Line', - 'version' => '8.0.2', + 'version' => '8.1.0', 'url' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://www.npmjs.com/package/appwrite-cli', 'enabled' => true, diff --git a/composer.json b/composer.json index 4c36ab125d..22ca53ee78 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,7 @@ }, "require-dev": { "ext-fileinfo": "*", - "appwrite/sdk-generator": "0.41.*", + "appwrite/sdk-generator": "dev-fix-attribute-creation-errors", "phpunit/phpunit": "9.*", "swoole/ide-helper": "5.1.2", "phpstan/phpstan": "1.8.*", diff --git a/composer.lock b/composer.lock index fd6a322076..45467bd4e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "55bc52686a08d64930e6af7411ac0654", + "content-hash": "71a256558261b19e11189c5967e5bd07", "packages": [ { "name": "adhocore/jwt", @@ -1463,16 +1463,16 @@ }, { "name": "open-telemetry/sem-conv", - "version": "1.32.0", + "version": "1.32.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "16585cc0dbc3032a318e274043454679430d2ebf" + "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/16585cc0dbc3032a318e274043454679430d2ebf", - "reference": "16585cc0dbc3032a318e274043454679430d2ebf", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", + "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", "shasum": "" }, "require": { @@ -1516,7 +1516,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-05T03:58:53+00:00" + "time": "2025-06-24T02:32:27+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -2327,21 +2327,20 @@ }, { "name": "ramsey/uuid", - "version": "4.8.1", + "version": "4.9.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28" + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28", - "reference": "fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", "shasum": "" }, "require": { "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", - "ext-json": "*", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -2400,9 +2399,9 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.8.1" + "source": "https://github.com/ramsey/uuid/tree/4.9.0" }, - "time": "2025-06-01T06:28:46+00:00" + "time": "2025-06-25T14:20:11+00:00" }, { "name": "spomky-labs/otphp", @@ -3494,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.7", + "version": "0.71.8", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "aa0116b2380125907fc18c82662be8e74c54091f" + "reference": "7dff6b67a54f1a7f9d3f210db4c6e40d7052b79e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/aa0116b2380125907fc18c82662be8e74c54091f", - "reference": "aa0116b2380125907fc18c82662be8e74c54091f", + "url": "https://api.github.com/repos/utopia-php/database/zipball/7dff6b67a54f1a7f9d3f210db4c6e40d7052b79e", + "reference": "7dff6b67a54f1a7f9d3f210db4c6e40d7052b79e", "shasum": "" }, "require": { @@ -3544,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.71.7" + "source": "https://github.com/utopia-php/database/tree/0.71.8" }, - "time": "2025-06-17T23:59:10+00:00" + "time": "2025-06-26T14:48:17+00:00" }, { "name": "utopia-php/detector", @@ -3943,16 +3942,16 @@ }, { "name": "utopia-php/messaging", - "version": "0.18.0", + "version": "0.18.1", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "c151aa5d4d475c788ca15c210b5b2017e21c41d6" + "reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/c151aa5d4d475c788ca15c210b5b2017e21c41d6", - "reference": "c151aa5d4d475c788ca15c210b5b2017e21c41d6", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/5d1245207a61d7ca065daddad7ac5f1d5640152f", + "reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f", "shasum": "" }, "require": { @@ -3988,9 +3987,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/0.18.0" + "source": "https://github.com/utopia-php/messaging/tree/0.18.1" }, - "time": "2025-05-15T05:00:03+00:00" + "time": "2025-06-26T18:26:07+00:00" }, { "name": "utopia-php/migration", @@ -4811,16 +4810,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.8", + "version": "dev-fix-attribute-creation-errors", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "93ffb24b25b376ca4423e3a5caf6f916673af4b2" + "reference": "a94668e92f9d8dd23770e1075076b2b9534f2886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/93ffb24b25b376ca4423e3a5caf6f916673af4b2", - "reference": "93ffb24b25b376ca4423e3a5caf6f916673af4b2", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/a94668e92f9d8dd23770e1075076b2b9534f2886", + "reference": "a94668e92f9d8dd23770e1075076b2b9534f2886", "shasum": "" }, "require": { @@ -4856,9 +4855,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.8" + "source": "https://github.com/appwrite/sdk-generator/tree/fix-attribute-creation-errors" }, - "time": "2025-06-18T13:20:45+00:00" + "time": "2025-06-27T06:11:13+00:00" }, { "name": "doctrine/annotations", @@ -8237,7 +8236,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "appwrite/sdk-generator": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docs/sdks/cli/CHANGELOG.md b/docs/sdks/cli/CHANGELOG.md index fa4d35e687..c2c93b0c09 100644 --- a/docs/sdks/cli/CHANGELOG.md +++ b/docs/sdks/cli/CHANGELOG.md @@ -1 +1,61 @@ -# Change Log \ No newline at end of file +# Change Log + +## 8.1.0 + +* Add multi-region support to `init` command +* Update `init` command to clear previous configuration in `appwrite.json` +* Update localConfig to store multi-region endpoint +* Fix throw error when creating unknown attribute instead of timing out +* Fix equal comparison of large numbers and BigNumber instances using proper equality checks +* Fix duplication of reasons when comparing localConfig with remoteConfig +* Fix `firstOrNull()` to `firstOrNull` in types generation for dart +* Refactor to use `isCloud()` method consistently + +## 8.0.2 + +* Add Type generation fixes: + * Properly handle enum attributes in dart, java and kotlin + * Fix initialisation of null attributes in dart's fromMap method + * Fix relationships and enums in swift + +## 8.0.1 + +* Add `resourceId` and `resourceType` attributes to `createRedirectRule` +* Add `providerReference` to vcs command for getting repository contents +* Add warning comment to `bulk updateDocuments` method +* Fix type generation for enums in Typescript and PHP language + +## 8.0.0 + +* Add `types` command to generate language specific typings for collections. Currently supports - `php`, `swift`, `dart`, `js`, `ts`, `kotlin` and `java` +* Update bulk operation docs to include experiment feature warnings +* Remove assistant service and commands + +## 7.0.0 + +* Add `sites` command +* Add `tokens` command +* Add `devKeys` support to `projects` command +* Add `init site`, `pull site` and `push site` commands +* Add bulk operation methods like `createDocuments`, `deleteDocuments` etc. +* Add new upsert methods: `upsertDocument` and `upsertDocuments` +* Update GET requests to not include content-type header + +## 6.2.3 + +* Fix hot swapping error in `python-ml` function + +## 6.2.2 + +* Fix GitHub builds by adding `qemu-system` package +* Fix attribute creation timed out + +## 6.2.1 + +* Add `listOrganizations` method to `organizations` service and fix init project command + +## 6.2.0 + +* Add specifications support to CLI +* Update package version +* Fix: Missed specifications param when updating a function \ No newline at end of file From f056a8ba2f18338957f2228aa4b9daf17de2c2de Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 27 Jun 2025 15:49:08 +0530 Subject: [PATCH 07/10] fix: composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 255f82224b..4c36ab125d 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,7 @@ }, "require-dev": { "ext-fileinfo": "*", - "appwrite/sdk-generator": "0.41.x", + "appwrite/sdk-generator": "0.41.*", "phpunit/phpunit": "9.*", "swoole/ide-helper": "5.1.2", "phpstan/phpstan": "1.8.*", From 156daca044167def9f73a57e31fb86312897cda0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 27 Jun 2025 15:50:32 +0530 Subject: [PATCH 08/10] fix: composer --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 60d039c562..05c8a49512 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "081385d2d7081b323429e45ffd3b3b33", + "content-hash": "55bc52686a08d64930e6af7411ac0654", "packages": [ { "name": "adhocore/jwt", From d6326758a8cabca9ab96e6b5b4ffe5c61c58ec51 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 30 Jun 2025 20:58:00 +0400 Subject: [PATCH 09/10] patch: increase cache ttl to ensure hits --- 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 735487339f..58b0f9a8a9 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -564,7 +564,7 @@ App::init() $cache = new Cache( new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()) ); - $timestamp = 60 * 60 * 24 * 30; + $timestamp = 60 * 60 * 24 * 180; // Temporarily increase the TTL to 180 day to ensure files in the cache are still fetched. $data = $cache->load($key, $timestamp); if (!empty($data) && !$cacheLog->isEmpty()) { From fd7628efe84308b6c04b17cb6fa2f48854f32149 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 30 Jun 2025 21:03:30 +0400 Subject: [PATCH 10/10] refactor: streamline cache handling in App::shutdown() and ensure file modification time updates --- app/controllers/shared/api.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 58b0f9a8a9..76fe177b0b 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -564,7 +564,7 @@ App::init() $cache = new Cache( new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()) ); - $timestamp = 60 * 60 * 24 * 180; // Temporarily increase the TTL to 180 day to ensure files in the cache are still fetched. + $timestamp = 60 * 60 * 24 * 180; // Temporarily increase the TTL to 180 day to ensure files in the cache are still fetched. $data = $cache->load($key, $timestamp); if (!empty($data) && !$cacheLog->isEmpty()) { @@ -831,6 +831,10 @@ App::shutdown() $resourceType = $parseLabel($pattern, $responsePayload, $requestParams, $user); } + $cache = new Cache( + new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()) + ); + $key = $request->cacheIdentifier(); $signature = md5($data['payload']); $cacheLog = Authorization::skip(fn () => $dbForProject->getDocument('cache', $key)); @@ -848,12 +852,11 @@ App::shutdown() } elseif (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_CACHE_UPDATE)) > $accessedAt) { $cacheLog->setAttribute('accessedAt', $now); Authorization::skip(fn () => $dbForProject->updateDocument('cache', $cacheLog->getId(), $cacheLog)); + // Overwrite the file every APP_CACHE_UPDATE seconds to update the file modified time that is used in the TTL checks in cache->load() + $cache->save($key, $data['payload']); } if ($signature !== $cacheLog->getAttribute('signature')) { - $cache = new Cache( - new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId()) - ); $cache->save($key, $data['payload']); } }