Commit Graph
7 Commits
Author SHA1 Message Date
Gerhard Scheikl 6e8724c9a4 fix(auth): clear stale Supabase auth cookies on invalid session
When getUser() rejects a present session cookie with user_not_found /
session_not_found / bad_jwt (e.g. a deleted account or a cookie that
outlived its session), the middleware now clears the sb-*-auth-token
cookies and redirects to /login instead of leaving the browser wedged
in a logged-out page that still renders a Sign out button.
2026-06-01 22:01:51 +02:00
Gerhard Scheikl 2c2afa458e feat(device): OAuth2 device-pairing flow for HA add-on (code/approve/token/tunnel + /activate) 2026-06-01 10:35:41 +02:00
Gerhard Scheikl e14e909700 feat(auth): mandatory 2FA (TOTP + WebAuthn passkeys) with hard enrollment gate, AAL2 step-up, and single-use recovery codes 2026-05-31 21:38:01 +02:00
Gerhard Scheikl 1adb6e7b3f fix(admin): no-store on middleware admin deny/redirect responses
The defense-in-depth admin guard in middleware short-circuits before the
route handlers' jsonNoStore runs, so its 401/403 JSON denials (and auth
redirects) were served without Cache-Control: no-store. Stamp no-store in
withCookies so every admin deny/redirect response is non-cacheable,
completing Finding #4 for the middleware-originated admin responses.
2026-05-31 13:51:25 +02:00
Gerhard Scheikl 535b2ef202 fix(admin): fresh SSR reads, atomic user delete + sanitized errors, cookie-rotation in middleware, no-store on admin APIs 2026-05-31 13:15:56 +02:00
Gerhard Scheikl fb4880a1d9 feat(admin): comprehensive admin interface (users, tunnels, metrics, audit, reserved subdomains)
Adds an authenticated admin surface gated by auth.users.app_metadata.role==='admin'.

- lib/auth/admin-guard.ts: requireAdmin() (pages) + requireAdminApi() (routes)
- middleware.ts: defense-in-depth /admin and /api/admin guarding
- API: users (list/detail/role/ban/delete), tunnels (list + active/quota/reset/reassign/regenerate-token/delete), metrics, audit log, reserved subdomains
- Self-lockout prevention (no self demote/ban/delete)
- Best-effort Redis kill-switch via dependency-free net-socket client (REDIS_URL)
- admin_audit_log + reserved_subdomains migration (RLS on, service-role only)
- Admin UI (overview, users, tunnels, reserved, audit) + conditional nav link
2026-05-31 10:58:23 +02:00
root c935e39fa1 initial commit 2026-05-29 17:07:00 +02:00