fix: filter Sites build runtimes by _APP_SITES_RUNTIMES - #12840
Conversation
listFrameworks was returning every framework runtime, so the Console showed uninstalled options unlike Functions. Filter against the env allowlist and reject unsupported buildRuntime on create/update. Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThis PR fixes a gap where Sites build runtimes were not filtered by
Confidence Score: 5/5
Important Files Changed
Reviews (5): Last reviewed commit: "test: cast sites allowlist assertion mes..." | Re-trigger Greptile |
After filtering by _APP_SITES_RUNTIMES, drop frameworks whose runtime list is empty so the Console does not offer unusable options. Co-authored-by: Cursor <cursoragent@cursor.com>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
If the default buildRuntime is excluded by _APP_SITES_RUNTIMES, point it at the first remaining enabled runtime so clients do not preselect an invalid value. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
| $allowList = \array_filter(\array_map('trim', \explode(',', System::getEnv('_APP_SITES_RUNTIMES', '')))); | ||
|
|
||
| if (!empty($allowList) && !\in_array($buildRuntime, $allowList, true)) { | ||
| throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Runtime "' . $buildRuntime . '" is not supported'); |
There was a problem hiding this comment.
We might want similar throw in builds worker, maybe even general.php router()
There was a problem hiding this comment.
Good point — I looked into this. Functions also only enforces _APP_FUNCTIONS_RUNTIMES at Create + list (not in the Builds worker or general.php router for v5); those paths just resolve against the full runtimes catalog. Sites now mirrors that at Create/Update + frameworks list, and the executor still gates via OPR_EXECUTOR_RUNTIMES. Happy to add worker/router allowlist checks for both Functions and Sites as a follow-up if we want that extra defense-in-depth.
…lowlist fix: filter Sites build runtimes by _APP_SITES_RUNTIMES
What does this PR do?
Self-hosted Sites settings showed all build runtimes (including Bun/Deno/uninstalled Node versions) in the Console dropdown, while Functions correctly filters by
_APP_FUNCTIONS_RUNTIMES.This mirrors the Functions
listRuntimesbehavior for Sites:GET /v1/sites/frameworksnow filters each framework'sruntimeslist against_APP_SITES_RUNTIMESbuildRuntimethat is not in the allowlist (when the allowlist is set)Reported in community threads: https://appwrite.io/threads/1525087225895718983
Test Plan
_APP_SITES_RUNTIMES=static-1,node-22,node-24(leave Bun/Deno out)general_argument_invalidRelated PRs and Issues
_APP_SITES_RUNTIMESnot being respected by frameworks configChecklist