Repository navigation
fix(repo): harden gateway, admin and dashboard after audit - #4
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit-driven hardening pass across the gateway, admin API, database layer, dashboard and tooling.
Gateway
504 upstream_timeoutis only returned once every candidate was tried (previously a single slow provider 504'd the request and left no attempt row).2xxanswers502instead of echoing the 2xx status with an error envelope./v1/*paths are handled inside the authenticated gateway scope: API key required, exactly onerequest_logsrow.modelid is trimmed into the forwarded body.stream_idle_timeout_mssetting;Accept,anthropic-versionand response headers (retry-after, rate-limit, request ids) are relayed; header values are sanitized.408/409/425and redirects;429 all_providers_rate_limitedcarriesRetry-Afterandx-opencode-router-cooldown-until.Authorizationaccepts theBearerscheme only; event emission is guarded; provider credentials are redacted from error messages.Admin / DB
/providers/testonly reuses a stored key for its own origin; providerid/name/baseUrl/upstream_user_agentreject control characters and credentialed URLs.PATCH /providers/:idresets status/cooldown when the URL, key or enabled flag changes;/models/bulkis capped and atomic;PATCH /settingsvalidates everything before writing.x-forwarded-protoonly affects theSecurecookie flag whenTRUST_PROXYis enabled; the events stream revalidates the session on every heartbeat and is capped; login guard gains a global per-window limit.session:<id>+ client IP and are pruned by the newaudit_retention_days; graceful shutdown drains in-flight requests.Dashboard
upstream_user_agent/retention/idle fields, top providers/keys cards, export truncation warning, in-flight states, per-id model toggle guard, staledefaultEffortcleanup, OS theme default, hidden-tab polling pauses and a11y fixes (inert modal background, real ids,aria-pressed, touch-visible row actions).Tests / CI / docs
400,503failover, timeout504, brute-force429, no key material in admin JSON,x_opencodeon every surface, port fail-fast).scripts/check-docs.ts(env vars, routes, settings vsdocs/SPEC.md/docs/API.md) wired into CI; tests/scripts are type-checked viatsconfig.test.json; commit linter hardened (Unicode lowercase, real merge detection, empty range fails).docs/SPEC.md,docs/API.md,README.md,AGENTS.md,CONTRIBUTING.mdupdated with the new behaviour and settings.Verification:
pnpm typecheck,pnpm test(242 tests),pnpm build,pnpm check:docs(no drift),pnpm test:e2e(86/86), andpnpm exec tsx scripts/screenshots.ts --strict(all pages render, no console errors).