Repository navigation
fix(organization): require an organization owner to transfer a project (appwrite:appwrite:alert#4623) - #15178
Conversation
…ect transfer The project transfer routes gated only on the `projects.write` scope, which `app/config/roles.php` hands to the organization-wide `developer` and `admin` roles and `app/config/scopes/organization.php` exposes to organization API keys. Moving a project with `PATCH /v1/projects/:projectId/team` needs a confirmed `owner` membership on both organizations, so the newer transfer routes let a non-owner member — or a CI organization key — move any project in the organization into one they control and defeat that rule. Hoist the owner lookup from the private method on `Projects/.../Team/Update.php` onto `User`, where it reads as behavior on the entity, and require it on the sending organization in `Transfers/Create.php` and `Transfers/Delete.php` and on the claiming organization in `Transfers/Status/Update.php`. Organization API keys carry no membership, so the same check refuses them. Co-Authored-By: Claude Opus 5 <[email protected]>
…tion owners The secret is the capability to move the project: anyone holding it can claim the project into an organization they own. `projects.read` reaches both the list and the get route, so a developer or admin member could read back a secret an owner had created and claim the project into an organization of their own, which is the same escalation the owner-only gate on create and claim refuses. Return the secret only to a confirmed owner of the organization that owns the project. Other organizations already never receive it. Co-Authored-By: Claude Opus 5 <[email protected]>
…only The API now requires the owner role on both organizations, so a developer or admin who was offered the card got a 401 from it, and the destination list offered organizations they could not claim into. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Review complete. No blocking issues — approved ✅; 2 nitpicks below. 🧹 Nitpicks (2) — 🟢 2 low
This PR introduces project transfers between organizations: new HTTP actions under
Reviewed commit: 0286736 |
New ConsoleProject ID: Tip Sites support three domain rule types: Active deployment, Git branch, and Redirect |
🟢 Tier S · Ready to mergeThe transfer endpoints now require confirmed organization ownership to create or delete transfer links, claim a project, or retrieve its secret. The shared owner check is also used by the project-team endpoint, and the Console gate and regression coverage reflect the owner-only rule.
📂 Walkthrough · 12
Reviewed |
commit: |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
fix(organization): require an organization owner to transfer a project (appwrite:appwrite:alert#4623) (cherry picked from commit 7a769f6)

What
appwrite:appwrite:alert#4623— the project transfer routes gated only on theprojects.writescope, so a non-owner organization member could move a project out of the organization and defeat the owner-only rule thatPATCH /v1/projects/:projectId/teamenforces.projects.writeis not an owner-only scope.app/config/roles.php:91puts it in the shared$adminsarray thatROLE_ADMINandROLE_DEVELOPERboth receive verbatim, andapp/config/scopes/organization.php:10exposes it as an organization API key scope.app/controllers/shared/api.php:557is the only gate on the transfer routes and it is purely scope-based, so a team-widedeveloperoradminmember — or a CI organization key — could create a transfer for any project in the organization and claim it into an organization they control. The same move through the sibling endpoint is refused for exactly those callers.Changes
Projects/Http/Projects/Team/Update.phpmoves ontoAppwrite\Utopia\Database\Documents\UserasisOwner(), where it reads as behavior on the entity, and both modules call it.Transfers/Create.phpandTransfers/Delete.phprequire a confirmedownermembership of the sending organization;Transfers/Status/Update.phprequires one of the claiming organization. The team endpoint keeps the exact behavior it had.auth:lists are unchanged —AuthType::ORGANIZATIONonly marks theX-Appwrite-Organizationheader, it never declared key support.projects.readreaches bothGET /v1/organization/transfersandGET /v1/organization/transfers/:transferId. Without this, a developer could read back a secret an owner had created and claim the project into an organization of their own — the same escalation, one step removed. Both routes now return the secret only to a confirmed owner of the sending organization; other organizations already never received it.canTransferProjectnow requiresaccess.isOwner, so the transfer card and the destination list stop offering an action that would 401. The blocked-state copy and itshe/jadictionary entries were updated with it.Tests
testProjectTransferRequiresOwnerintests/e2e/Services/Organization/TransfersBase.phpis the regression, written before the fix and failing against the old code. It invites a confirmeddeveloperand a confirmedadmininto the sending organization and adeveloperinto the claiming one, then asserts each is refused on create, delete and claim, that neither can read the secret back from the list or the get route, that the project has not moved, and that the actual owner can still claim it.The other direction — an organization API key — is not covered by an e2e test because this repository has no endpoint that mints one; organization keys are created by an edition on top of it.
The
console-rolesecurity probe intests/e2e/Securitydoes not catch this class of bug by construction: itsapplies()returns early when the route's scope is in the developer's scope set, whichprojects.writeis. Worth a follow-up, but not folded in here.Verification
composer lintand PHPStan clean on every touched PHP file.apk add 'ca-certificates>=20261020-r0'constraint in thecomposer:2stage, so the Organization lane in CI is the run that matters here.🤖 Generated with Claude Code