Repository navigation
chore: remove dev keys - #13696
chore: remove dev keys#13696
Conversation
Remove the dev key routes, model, query validator, scopes, CORS header, spec security scheme, and the request/realtime handling that let a dev key bypass abuse limits, CSRF, and origin/redirect validation. Drop the devKeys collection and project attribute from the platform schema; V25 deletes both from existing installs.
| 'array' => false, | ||
| 'filters' => ['subQueryKeys'], | ||
| ], | ||
| [ |
There was a problem hiding this comment.
Lets note down to do migration on cloud to remove these too
| "Access to create, update, and delete organization projects' API keys", | ||
| "category" => "Projects", | ||
| ], | ||
| "devKeys.read" => [ |
There was a problem hiding this comment.
Also migration, to remove from existing keys and functions/sites
| 'devKeys.read', | ||
| 'devKeys.write', |
There was a problem hiding this comment.
We might need cloud PR that removes these from ustom roles. maybe not, but lets check
| ); | ||
|
|
||
| Database::addFilter( | ||
| 'subQueryDevKeys', |
There was a problem hiding this comment.
Lets check cloud for this too, we might have some filters override that touch this filter key
There was a problem hiding this comment.
Lets avoid changing existing migrations
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
| $this->dbForProject->deleteCollection('devKeys'); | ||
| } catch (Throwable $th) { | ||
| Console::warning("Failed to delete collection \"devKeys\": {$th->getMessage()}"); | ||
| } |
There was a problem hiding this comment.
I think we need to iterate api keys, functions and sites, to remove the scopes we removed
There was a problem hiding this comment.
Lets not touch historical filters, instead, add new one
|
| $this->assertEquals(Exception::DEV_KEY_GONE, $response['body']['type']); | ||
| } | ||
|
|
||
| public function testProjectLabels(): void |
There was a problem hiding this comment.
Security Removal Lacks Coverage
This removes the only dev-key endpoint test without replacing it with observable coverage. No test now shows that legacy header or query credentials cannot bypass abuse limits, CSRF, origin checks, or OAuth redirect validation. There is also no test showing that the removed routes are unavailable or that V25 removes existing dev-key schema and records. Add end-to-end tests for these externally visible outcomes rather than assertions that mirror configuration or source symbols.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/e2e/Services/Projects/ProjectsConsoleClientTest.php
Line: 6312
Comment:
**Security Removal Lacks Coverage**
This removes the only dev-key endpoint test without replacing it with observable coverage. No test now shows that legacy header or query credentials cannot bypass abuse limits, CSRF, origin checks, or OAuth redirect validation. There is also no test showing that the removed routes are unavailable or that V25 removes existing dev-key schema and records. Add end-to-end tests for these externally visible outcomes rather than assertions that mirror configuration or source symbols.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Historical migrations and response filters stay as released.
… failures V25 removes devKeys.read and devKeys.write from key, function and site scopes. The devKeys attribute and collection are deleted only when they exist, and a failed delete now aborts the migration instead of logging a warning, since project documents cannot be decoded while the attribute remains.
….3.0 Add the V28 response filter, which returns an empty devKeys list on projects for older response formats, and fill devKeys in the generated SDK hydration test since the published PHP SDK still requires it.
| if (!$this->dbForProject->getCollection('devKeys')->isEmpty()) { | ||
| $this->dbForProject->deleteCollection('devKeys'); |
There was a problem hiding this comment.
Empty Collection Survives Migration
When the legacy devKeys collection exists but contains no documents, isEmpty() returns true and the migration skips deleteCollection(). Since earlier migrations create this collection even if it is never populated, an upgrade can complete while leaving the legacy schema behind. Delete the collection whenever it exists, regardless of its document count.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Migration/Version/V25.php
Line: 84-85
Comment:
**Empty Collection Survives Migration**
When the legacy `devKeys` collection exists but contains no documents, `isEmpty()` returns true and the migration skips `deleteCollection()`. Since earlier migrations create this collection even if it is never populated, an upgrade can complete while leaving the legacy schema behind. Delete the collection whenever it exists, regardless of its document count.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.The SDK hydration test now builds the project response the way the server does, running output() and then the V28 filter that older response formats receive, instead of adding devKeys to the fixture by hand.
# Conflicts: # app/controllers/api/account.php
Dev keys were removed from the API (appwrite#13696, appwrite-labs/cloud#5842) and this console never had a page for them, but the docs still taught the feature. Drop the dev keys page and its screenshots, the dev keys sections on the rate limits and partners API keys pages, the security card and nav entry, and the three dead console references to the retired scopes and legacy path segment. The old page URLs redirect to the rate limits page so inbound links keep resolving. Blog posts and changelog entries stay as dated history. Co-Authored-By: Claude Fable 5.1 <[email protected]>
What does this PR do?
Removes dev keys entirely. #12931 stopped new dev keys from being created (410), but existing keys were still accepted and still bypassed abuse limits, CSRF protection, and origin/redirect validation, including the OAuth2 success/failure URL checks.
DevKeymodel, theDevKeysquery validator and thedev_key_goneerrorX-Appwrite-Dev-Key/?devKey=handling from the HTTP and realtime request resources, along with the bypasses inshared/api.php,general.phpand the OAuth2 redirectdevKeys.read/devKeys.writescopes, the CORS allowed header, the ProjectdevKeysfield and theDevKeyspec security schemedevKeyscollection, the projectdevKeysattribute and thesubQueryDevKeysfilter. V25 deletes the attribute and collection on existing installsOlder migrations and
Migrate.phpstill registersubQueryDevKeysas a no-op filter: the stored project attribute references it, and documents cannot be decoded without it until V25 has dropped the attribute. Untilmigrateruns on an existing install, project reads fail withFilter "subQueryDevKeys" not found.Test Plan
php -land Pint on every changed fileRelated PRs and Issues
Checklist