mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix: centralize public origin checks for proxied dashboards (#5278)
Centralizes browser-mutation origin validation into `src/server/origin/publicOrigin.ts` and wires it through the authz pipeline, replacing the per-route same-origin-only check that 403'd dashboard mutations when served behind a reverse proxy on a different public origin. The new module resolves the allowed public origin from configured base-URL env vars or trusted forwarded headers (only when OMNIROUTE_TRUST_PROXY is set AND the peer is loopback/LAN via peer-stamp), validates Sec-Fetch-Site metadata, and sanitizes Host/Forwarded inputs (rejects control chars, userinfo, path/query in Host). Reviewed sound; validated locally: authz/public-origin + pipeline suites 27/27 green (incl. invalid-origin reject + configured-origin accept), typecheck clean. Maintainer fix-up: moved the new test from tests/unit/server/ (not collected by any runner — orphan-test gate fail) into tests/unit/authz/. Remaining red CI shards are the pre-existing #4076 Dockerfile heap base-red on `main` (unrelated; de-brittled in the v3.8.40 release line). Co-authored-by: Thinkscape <Thinkscape@users.noreply.github.com>
This commit is contained in:
@@ -190,7 +190,11 @@ services:
|
||||
- omniroute-data:/app/data
|
||||
environment:
|
||||
- PORT=20128
|
||||
# Browser-facing origin for OAuth callbacks, dashboard links, and same-origin checks.
|
||||
- NEXT_PUBLIC_BASE_URL=https://your-domain.com
|
||||
# Internal server-to-server URL for scheduled jobs / self-fetches.
|
||||
- BASE_URL=http://omniroute:20128
|
||||
- AUTH_COOKIE_SECURE=true
|
||||
|
||||
caddy:
|
||||
image: caddy:latest
|
||||
@@ -205,6 +209,11 @@ volumes:
|
||||
omniroute-data:
|
||||
```
|
||||
|
||||
Caddy sets the standard forwarding headers for the upstream container. OmniRoute uses
|
||||
`NEXT_PUBLIC_BASE_URL` as the canonical public origin; only enable `OMNIROUTE_TRUST_PROXY` for
|
||||
advanced deployments where you intentionally want OmniRoute to derive the public origin from
|
||||
trusted forwarded headers instead of explicit configuration.
|
||||
|
||||
## Cloudflare Quick Tunnel
|
||||
|
||||
Dashboard support for Docker deployments includes a one-click **Cloudflare Quick Tunnel** on `Dashboard → Endpoints`. The first enable downloads `cloudflared` only when needed, starts a temporary tunnel to your current `/v1` endpoint, and shows the generated `https://*.trycloudflare.com/v1` URL directly below your normal public URL.
|
||||
|
||||
Reference in New Issue
Block a user