Repository navigation
fix: gate development-only routes on an explicit development env - #14824
Conversation
Mock routes and the time-travel task treated a missing _APP_ENV as development while the server defaults to production.
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Mock JWKS and id-token routes bypass the new dev gate · mock.php:272–332 · // app/controllers/mock.php
272 Http::get('/v1/mock/tests/general/oauth2/jwks')
273 ->desc('OAuth2 JWKS')
274 ->groups(['mock'])
275 ->label('scope', 'public')
276 ->label('docs', false)
277 ->label('mock', true)
278 ->inject('response')
279 ->inject('cache')
280 ->inject('lock')
281 ->action(function (Response $response, Cache $cache, Lock $lock) {
282 $key = (new SigningKey($cache, $lock))->get();
283 $details = \openssl_pkey_get_details($key);The PR gates the three state-mutating mock routes on 🧹 Nitpicks (1) — 🟢 1 low
This PR closes a dev-mode escape hatch: routes and CLI tasks that previously activated whenever
Two residual gaps remain: the mock JWKS/id-token GET routes still bypass the gate, and Reviewed commit: 138f838 |
🟢 Tier S · Ready to merge
Development-only mock endpoints and the
📂 Walkthrough · 2
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
…ction fix: gate development-only routes on an explicit development env (cherry picked from commit 678ec9d)
What
The development-only mock routes in
app/controllers/mock.php(and thetime-travelCLI task) read_APP_ENVwith adevelopmentdefault, while the server itself defaults toproduction(app/http.php,app/init/registers.php). A deployment that never set_APP_ENVtherefore ran as production everywhere except these gates.They now default to
production, so they only open when_APP_ENV=developmentis set explicitly. The installer already writes_APP_ENV=production, so standard installs are unaffected.Tests
The CI stack sets
_APP_ENV=development, so the existing e2e tests that use these mock routes keep exercising them (and would fail if the gate closed with the variable set). The changed default only matters when the variable is missing, which the e2e environment cannot express without a separate stack; no new test.Related: appwrite-labs/cloud#6674