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(oidc,ui): restore Authentik login and fix mobile delete dialog (#845)
Julien G.58218ff5f6c5
diff --git a/client/src/components/shared/ConfirmDialog.tsx b/client/src/components/shared/ConfirmDialog.tsxindex 31cd92958..d75ad1905 100644--- a/client/src/components/shared/ConfirmDialog.tsx+++ b/client/src/components/shared/ConfirmDialog.tsx@@ -41,7 +41,7 @@ export default function ConfirmDialog({return (<divclassName="fixed inset-0 z-[10000] flex items-center justify-center px-4 trek-backdrop-enter"- style={{ backgroundColor: 'rgba(15, 23, 42, 0.5)' }}+ style={{ backgroundColor: 'rgba(15, 23, 42, 0.5)', paddingBottom: 'var(--bottom-nav-h)' }}onClick={onClose}><divdiff --git a/client/src/components/shared/CopyTripDialog.tsx b/client/src/components/shared/CopyTripDialog.tsxindex efea7afbd..0cd4cf8ba 100644--- a/client/src/components/shared/CopyTripDialog.tsx+++ b/client/src/components/shared/CopyTripDialog.tsx@@ -42,7 +42,7 @@ export default function CopyTripDialog({ isOpen, tripTitle, onClose, onConfirm }return (<divclassName="fixed inset-0 z-[10000] flex items-center justify-center px-4 trek-backdrop-enter"- style={{ backgroundColor: 'rgba(15, 23, 42, 0.5)' }}+ style={{ backgroundColor: 'rgba(15, 23, 42, 0.5)', paddingBottom: 'var(--bottom-nav-h)' }}onClick={onClose}><divdiff --git a/server/src/routes/oidc.ts b/server/src/routes/oidc.tsindex dcd21a780..4a86a340a 100644--- a/server/src/routes/oidc.ts+++ b/server/src/routes/oidc.ts@@ -112,7 +112,7 @@ router.get('/callback', async (req: Request, res: Response) => {tokenData.id_token,doc,config.clientId,- config.issuer,+ (doc.issuer ?? '').replace(/\/+$/, '') || config.issuer,);if (idVerify.ok !== true) {const reason = 'error' in idVerify ? idVerify.error : 'unknown';diff --git a/server/src/services/oidcService.ts b/server/src/services/oidcService.tsindex 1a8b660f8..42c0c5cdb 100644--- a/server/src/services/oidcService.ts+++ b/server/src/services/oidcService.ts@@ -140,11 +140,21 @@ export async function discover(issuer: string, discoveryUrl?: string | null): Prconst res = await fetch(url);if (!res.ok) throw new Error('Failed to fetch OIDC discovery document');const doc = (await res.json()) as OidcDiscoveryDoc;- // Validate that the discovery doc's issuer matches the operator-configured- // one. A MITM or compromised doc could otherwise supply a crafted issuer- // that passes jwt.verify() because we used doc.issuer as the expected value.- if (doc.issuer && doc.issuer.replace(/\/+$/, '') !== issuer) {- throw new Error(`OIDC discovery issuer mismatch: expected "${issuer}", got "${doc.issuer}"`);+ // Validate that the discovery doc's issuer matches the operator-configured one.+ // When no custom discoveryUrl is set, a mismatch signals a MITM or misconfiguration+ // and we reject. When the operator explicitly overrides the discovery URL (e.g.+ // Authentik realm paths), the discovery doc's issuer is the canonical value —+ // trust it and warn rather than blocking login.+ const docIssuer = doc.issuer?.replace(/\/+$/, '') ?? '';+ if (docIssuer && docIssuer !== issuer) {+ if (discoveryUrl) {+ console.warn(+ `[OIDC] Discovery doc issuer "${doc.issuer}" differs from configured OIDC_ISSUER "${issuer}". ` ++ `Using discovery doc issuer for id_token verification (custom OIDC_DISCOVERY_URL is set).`,+ );+ } else {+ throw new Error(`OIDC discovery issuer mismatch: expected "${issuer}", got "${doc.issuer}"`);+ }}doc._issuer = url;discoveryCache = doc;diff --git a/server/tests/unit/services/oidcService.test.ts b/server/tests/unit/services/oidcService.test.tsindex 5e27b5fb5..5de82a4b7 100644--- a/server/tests/unit/services/oidcService.test.ts+++ b/server/tests/unit/services/oidcService.test.ts@@ -219,6 +219,59 @@ describe('discover', () => {vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: false }));await expect(discover('https://bad-issuer.example.com')).rejects.toThrow();});++ it('OIDC-SVC-037: accepts mismatched doc issuer when discoveryUrl is explicit', async () => {+ const doc = {+ issuer: 'https://auth.example.com/application/o/myapp/',+ authorization_endpoint: 'https://auth.example.com/application/o/myapp/authorize/',+ token_endpoint: 'https://auth.example.com/application/o/token/',+ userinfo_endpoint: 'https://auth.example.com/application/o/userinfo/',+ };+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true, json: async () => doc }));+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});++ const result = await discover(+ 'https://auth.example.com',+ 'https://auth.example.com/application/o/myapp/.well-known/openid-configuration',+ );++ expect(result.issuer).toBe(doc.issuer);+ expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('differs from configured OIDC_ISSUER'));+ warnSpy.mockRestore();+ });++ it('OIDC-SVC-038: throws on mismatched doc issuer when discoveryUrl is omitted', async () => {+ const doc = {+ issuer: 'https://evil.example.com',+ authorization_endpoint: 'https://unique-2.example.com/auth',+ token_endpoint: 'https://unique-2.example.com/token',+ userinfo_endpoint: 'https://unique-2.example.com/userinfo',+ };+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true, json: async () => doc }));++ await expect(discover('https://unique-2.example.com')).rejects.toThrow(+ 'OIDC discovery issuer mismatch',+ );+ });++ it('OIDC-SVC-039: trailing-slash-only mismatch with explicit discoveryUrl does not warn', async () => {+ const doc = {+ issuer: 'https://auth.example.com/',+ authorization_endpoint: 'https://auth.example.com/auth',+ token_endpoint: 'https://auth.example.com/token',+ userinfo_endpoint: 'https://auth.example.com/userinfo',+ };+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true, json: async () => doc }));+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});++ await discover(+ 'https://auth.example.com',+ 'https://auth.example.com/.well-known/openid-configuration',+ );++ expect(warnSpy).not.toHaveBeenCalled();+ warnSpy.mockRestore();+ });});// ── issuer trailing-slash regex (ReDoS guard) ─────────────────────────────────