Repository navigation
fix(compute): keep function and site scopes within the calling key - #15026
Conversation
Functions and sites sign their scopes into the keys their builds and executions receive. An API key configuring them may now only add scopes it holds itself; scopes already on the resource are kept.
|
Review complete. No issues found — approved ✅. This PR prevents API keys from escalating privileges by creating or updating Functions and Sites with scopes the key does not itself hold.
Reviewed commit: f588dd0 |
🟢 Tier S · Ready to merge
Adds API-key scope containment for function and site creation and updates, preserving existing resource scopes while restricting newly granted scopes. Migration-generated keys now receive the full project-scope catalog so migrated functions and sites can retain valid scopes. Latest changes: The new commits derive migration API-key scopes from the project scope catalog and extend the migration site test to verify preservation of
📂 Walkthrough · 10
Reviewed the commits since |
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)
|
Functions and sites are recreated in the destination through the API with the worker's temporary key. Now that a key may only grant scopes it holds, a function or site holding databases.*, tables.*, rows.*, execution.* or any other scope missing from the hardcoded list failed to migrate with general_unauthorized_scope. Give the key every project scope so migrated resources keep theirs.
Functions and sites sign their scopes into the keys their builds and executions receive. An API key configuring them may now only add scopes it holds itself; scopes already on the resource are kept.
Lint, PHPStan and the touched unit tests passed locally before rebasing on main; e2e runs in CI.
Appwrite to Appwrite migrations recreate functions and sites through the API with the migration worker's temporary key, which only held a hardcoded list of scopes. That key now holds every project scope, so a function or site holding
databases.*,tables.*,execution.*or similar still migrates;testAppwriteMigrationSitenow migrates a site withdatabases.readto cover it.Part of appwrite-labs/cloud#6857