Repository navigation
chore(deps): update appwrite/appwrite to ^32.2.0 (appwrite:appwrite:alert#4729) - #28
Merged
ArnabChatterjee20k merged 1 commit intoNov 16, 2026
Conversation
…lert#4729) appwrite/appwrite#15470 made the abuse limits on the routes that confirm a short secret count for every caller, an API key holder included. It touched only the server's route labels, so the generated PHP SDK is unchanged — but the contract a server-side caller codes against is not: a key that used to be waived from those limits now gets 401 for a wrong secret and 429 once a user's attempts are spent, and a spent limit refuses the correct secret too. The manifest moves to the SDK's current major, which needs PHP 8.5 and renames collections and documents to tables and rows, so: - composer.json: appwrite/appwrite ^12.0.0 -> ^32.2.0, php >=8.5, ext-json, and a `test` script; - playground.php: Databases -> TablesDB, array responses -> typed models, Runtime::PHP80 -> PHP84, and a `createSessionFromToken()` call that shows how to handle 401 and 429 on the session exchange rather than retry into it; - resources: the function template's own SDK to ^28.0 (the PHP 8.4 runtime cannot take 32.x), and its archive rebuilt without the macOS metadata files; - Dockerfile: php 8.5, and no COPY of the gitignored composer.lock; - tests/: a stub Appwrite over PHP's built-in server, a smoke test that runs the whole playground against it, and tests/code-guesses.php for this fix — ten wrong guesses answer 401 and the eleventh 429 for a key-holding caller, per user, on both the session exchange and the recovery OTP confirmation; - .github/workflows/tests.yml: lint and `composer test` on PHP 8.5. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🟢 Tier S · Ready to merge
This PR upgrades the PHP SDK and migrates the playground's database examples to TablesDB, updating the PHP and Docker requirements along the way. It adds recovery and token-session examples, documents abuse-limit responses, and introduces stub-backed tests for the playground and confirmation routes.
📂 Walkthrough · 13
Reviewed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Cascades appwrite/appwrite#15470 (code scanning alert #4729) into this playground.
Upstream touched only the server's route labels —
Limit::attempts(...)/Limit::failures(...)gainedeveryone: trueon the recovery and session confirmations — so the generated PHP SDK is byte-identical; no method signature here changed. What did change is the contract a server-side caller codes against:Concretely, for
updateRecovery(),updateRecoveryOTP(),createSession(),updatePhoneSession(),updateMagicURLSession()andupdateMFAChallenge(): a wrong secret is401, and once a user's handful of attempts is spent the route answers429— to the correct secret too. An SSR backend that retries a mistyped code with its key now locks that user out for the rest of the window, so the playground has to show the handling rather than the happy path alone.Dependency
appwrite/appwrite^12.0.0→^32.2.0. That is a multi-major move and it carries the rest of this diff with it:php>=8.0→>=8.5, andext-json, both required by the SDK itself.Databases→TablesDB(collections and documents became tables and rows in Appwrite 1.8; theDatabasesservice still exists but every method on it is deprecated).$response['$id']→$response->id.Runtime::PHP80()→Runtime::PHP84().resources/: the function template's own SDK to^28.0— the PHP 8.4 function runtime cannot take 32.x, which needs 8.5 — and its archive rebuilt without the macOS._*metadata files it was carrying.Dockerfile:php:8.5-cli-alpine, and it no longerCOPYs the gitignoredcomposer.lock(thatCOPYfails on a clean checkout).Playground
createSessionFromToken()is new:users->createToken()with the key, thenaccount->createSession(), which is the route upstream stopped exempting keys from. It handles401and429instead of retrying, and its docblock says why the retry is the dangerous part.Test Plan
tests/is new — a stub Appwrite served by PHP's built-in web server, so there is no Appwrite instance or network access needed.composer testruns both files, and CI (.github/workflows/tests.yml) lints every file and runs it on PHP 8.5.tests/smoke.php— runs the whole playground against the stub: 21 calls over 26 requests, every one succeeding and hitting the endpoint it meant to. It also fails on any request to/v1/databases(the deprecated service), on any request missing the project, and on a session exchange that did not carry the API key — so the test below cannot pass by the playground quietly dropping the key.tests/code-guesses.php— this fix. Against a stub that counts wrong guesses per project, route and user without looking at the key: the correct secret still exchanges for a session; ten wrong guesses answer401typeduser_invalid_token; the eleventh answers429typedgeneral_rate_limit_exceeded; another user still has its own count; the recovery OTP confirmation behaves the same way and, once spent, refuses the correct secret too. The session exchange's limits count failures rather than requests, so the successful exchange ahead of the ten guesses does not eat into the share — the test is ordered to pin that down.Both verified to fail against the pre-fix behaviour: exempting a key-holding caller in the stub turns the five
429assertions into401/201.Local:
composer testgreen on PHP 8.5.12,php -lclean on every file,docker buildof the playground image green and its autoloader resolvingAppwrite\Services\TablesDB.Note on overlap
The
^32.2.0bump and the TablesDB migration are shared with the other open cascades (#21, #22, #23, #24, #25, #26, #27) — whichever lands first, the rest reduce to their own playground call and test file. OnlycreateSessionFromToken(),tests/code-guesses.phpand the confirmation-route half of the README section are specific to this alert.🤖 Generated with Claude Code