Repository navigation
fix(realtime): end admin-mode connections with console access - #15060
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
An admin-mode connection is registered in the project it administers, so console events about its user never reached it. Record the console user and membership on the connection and re-check them when that user's console access changes: session ended, user blocked or deleted, membership removed or changed, or the project moved to another organization. Console account events now reach realtime so signing out of the console is one of them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. 🟠 1 high · 🟡 1 medium 💬 Inline comments (1)
📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Re-auth leaves stale An admin-mode connection stores 🧹 Nitpicks (2) — 🟢 2 low
This PR closes admin-mode realtime connections when the console access that granted them ends.
Review note: one scanner covering connection-lifecycle corner cases completed after the main verification pass; its low-severity performance candidate was adjudicated and rejected, so no findings were omitted from the verified set. Reviewed commit: cea47e9 |
🟢 Tier S · Ready to merge
Admin-mode realtime connections now retain the console user and organization membership that authorized them. Console account and membership events revalidate those connections, while organization deletion and project transfers close connections whose access has ended. The change also centralizes membership-role lookup and adds end-to-end coverage for revocation, transfer, blocking, and re-authentication behavior.
📂 Walkthrough · 6
✅ Fixed since the last review · 1
Merged |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
There was a problem hiding this comment.
Adds admin-mode connection tracking and revocation to realtime, extending console allowlist and User membership helpers, with a new e2e test.
Key findings
- 🟠 Block/delete events never recheck admin connections — Realtime.php:15
- 🟡 Re-auth leaves stale
adminmetadata on connection — Authentication.php
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Console user events reach realtime too, so blocking or deleting a console user ends their admin-mode connections. An admin-mode connection can no longer re-authenticate with a project session, which would keep its admin roles while dropping out of the console checks. Covers the transfer and re-authentication paths in the e2e test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in-revocation # Conflicts: # src/Appwrite/Utopia/Database/Documents/User.php
Co-Authored-By: Claude Fable 5 <[email protected]>
|
@hansi-codes review |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…deleted Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@hansi-codes review |
…in-revocation # Conflicts: # tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php
|
Follow-up on the tenki review of cea47e9, so every finding has an answer:
|
What does this PR do?
An admin-mode realtime connection (a console user connecting to a project with
x-appwrite-mode: admin) is registered in the project it administers, with no project user. Every path that ends a connection when access changes looks connections up by project user, or by the console user in theconsoleproject, so none of them reached it. A console user who signed out of the console or was removed from the organization kept receiving the project's events until the socket closed or the console session expired.This PR:
adminin the connection tree), withRealtime::getAdminConnections()to find them.unauthorizedframe.projects.{id}.update.team), closes admin-mode connections opened through the previous organization.accounttoRealtime::CONSOLE_ALLOWLIST, so console account events (sign-out, session deletion, status) reach realtime. Before this, nothing reached realtime when a console user signed out.User::getMembershipRoles(), used both when the connection opens and when it is re-checked.Tracking: appwrite-labs/cloud#7054
Test Plan
New e2e test
RealtimeConsoleClientTest::testAdminModeEndsWithConsoleAccess:Red/green on a local stack:
Timed out waiting for the server to close the socket. Each was run on its own.RealtimeConsoleClientTestpasses (20 tests).RealtimeCustomClientTesthas the same pass/fail set with and without the change. Its 8 failures there come from the local stack (policy and transaction endpoints are not on the HTTP side) and are unrelated.Related PRs and Issues
Checklist
🤖 Generated with Claude Code