Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: case-insensitive Bearer scheme, drop unused /healthz from auth public set
Adam Eivyba2b1ae824fb
diff --git a/server/lib/authGate.js b/server/lib/authGate.jsindex a91d1fea7e..6a301a6e3c 100644--- a/server/lib/authGate.js+++ b/server/lib/authGate.js@@ -3,8 +3,8 @@ import { extractToken, isAuthEnabled, verifySession } from '../services/auth.js'// Paths that bypass the auth gate even when a password is set:// - /api/auth/status, /api/auth/whoami, /api/auth/login → the login UI// itself needs to reach these to render and sign in.-// - /api/system/health (and the cheap /healthz used by uptime checks) — the-// server has to be reachable by Tailscale's healthcheck without a session.+// - /api/system/health — Tailscale's reachability check shouldn't need a+// session.// Anything not on this list returns 401 when auth is on and the request has// no valid token.const PUBLIC_API_PATHS = new Set([@@ -13,7 +13,6 @@ const PUBLIC_API_PATHS = new Set(['/api/auth/login','/api/auth/logout','/api/system/health',- '/healthz',]);const isPublicPath = (path) => {diff --git a/server/services/auth.js b/server/services/auth.jsindex 3eb6e44577..d13d7db020 100644--- a/server/services/auth.js+++ b/server/services/auth.js@@ -210,8 +210,10 @@ export const extractToken = (req) => {const cookie = parseCookieToken(req.headers?.cookie);if (cookie) return cookie;const authHeader = req.headers?.authorization;- if (typeof authHeader === 'string' && authHeader.startsWith('Bearer ')) {- return authHeader.slice('Bearer '.length).trim();+ // RFC 6750: Bearer scheme name is case-insensitive.+ if (typeof authHeader === 'string' && authHeader.length > 7+ && authHeader.slice(0, 7).toLowerCase() === 'bearer ') {+ return authHeader.slice(7).trim();}return null;};diff --git a/server/services/auth.test.js b/server/services/auth.test.jsindex 7e8a5412c8..fd15fbc412 100644--- a/server/services/auth.test.js+++ b/server/services/auth.test.js@@ -112,6 +112,9 @@ describe('auth service', () => {expect(auth.parseCookieToken(null)).toBe(null);expect(auth.extractToken({ headers: { cookie: 'portos_auth=cookie-token' } })).toBe('cookie-token');expect(auth.extractToken({ headers: { authorization: 'Bearer header-token' } })).toBe('header-token');+ // RFC 6750: scheme name is case-insensitive — accept lowercase / mixed.+ expect(auth.extractToken({ headers: { authorization: 'bearer lowercase' } })).toBe('lowercase');+ expect(auth.extractToken({ headers: { authorization: 'BEARER mixed' } })).toBe('mixed');expect(auth.extractToken({headers: { cookie: 'portos_auth=cookie-wins', authorization: 'Bearer header-loses' },})).toBe('cookie-wins');