Repository navigation
fix(api): let API keys call public-scope endpoints - #15156
Conversation
Keys carry only the scopes they were given, and 'public' is not one a key can be given, so every key was refused on routes open to guests, such as listing function runtimes, which the CLI calls during init.
Security rulesWARNING (2 new) — review signal only; does not fail the job.
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
|
Review complete. No issues found — approved ✅. This change makes API keys implicitly carry the
Reviewed commit: 29b01cc |
🟢 Tier S · Ready to merge
API-key requests now include the
📂 Walkthrough · 2
Reviewed |
Problem
Any API key calling an endpoint with the
publicscope, such asGET /v1/functions/runtimesor the sites frameworks list, getsmissing scopes (["public"]). Key auth replaces the role's scopes with the key's own, andpublicis not a scope a key can be given. This breaksappwrite init functionin CI, which lists runtimes with a key.Fix
app/controllers/shared/api.php: a key's request scopes are its scopes pluspublic. Guests already holdpublic, so this widens nothing. Every key type (standard, ephemeral, dynamic, organization, account) goes through this line.publicis still not offered as a selectable key scope.Test
FunctionsCustomServerTest::testGetRuntimesnow also lists runtimes with only the server API key and asserts 200 and a non-empty list. The existing calls sent no key, so they never hit this path.Related: appwrite-labs/cloud#6666