The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix: prevent OIDC redirect URI construction from untrusted X-Forwarded-Host
jubnl0ee53e7b388c
diff --git a/server/.env.example b/server/.env.exampleindex 2aae17983..490447cb0 100644--- a/server/.env.example+++ b/server/.env.example@@ -8,6 +8,8 @@ ALLOWED_ORIGINS=https://trek.example.com # Comma-separated origins for CORS andFORCE_HTTPS=false # Redirect HTTP → HTTPS behind a TLS proxyTRUST_PROXY=1 # Number of trusted proxies for X-Forwarded-For+APP_URL=https://trek.example.com # Base URL of this instance — required when OIDC is enabled; must match the redirect URI registered with your IdP+OIDC_ISSUER=https://auth.example.com # OpenID Connect provider URLOIDC_CLIENT_ID=trek # OpenID Connect client IDOIDC_CLIENT_SECRET=supersecret # OpenID Connect client secretdiff --git a/server/src/routes/oidc.ts b/server/src/routes/oidc.tsindex 7f38dd81b..0c3686f97 100644--- a/server/src/routes/oidc.ts+++ b/server/src/routes/oidc.ts@@ -123,14 +123,10 @@ router.get('/login', async (req: Request, res: Response) => {const doc = await discover(config.issuer);const state = crypto.randomBytes(32).toString('hex');const appUrl = process.env.APP_URL || (db.prepare("SELECT value FROM app_settings WHERE key = 'app_url'").get() as { value: string } | undefined)?.value;- let redirectUri: string;- if (appUrl) {- redirectUri = `${appUrl.replace(/\/+$/, '')}/api/auth/oidc/callback`;- } else {- const proto = (req.headers['x-forwarded-proto'] as string) || req.protocol;- const host = (req.headers['x-forwarded-host'] as string) || req.headers.host;- redirectUri = `${proto}://${host}/api/auth/oidc/callback`;+ if (!appUrl) {+ return res.status(500).json({ error: 'APP_URL is not configured. OIDC cannot be used.' });}+ const redirectUri = `${appUrl.replace(/\/+$/, '')}/api/auth/oidc/callback`;const inviteToken = req.query.invite as string | undefined;pendingStates.set(state, { createdAt: Date.now(), redirectUri, inviteToken });