Commit Graph

10 Commits

Author SHA1 Message Date
Gerhard Scheikl 37f1e7bbd5 feat(auth): SSR email confirmation flow
- Add /auth/confirm GET route handler that verifies the signup token via
  verifyOtp({ type, token_hash }) and falls back to exchangeCodeForSession
  when a PKCE code is present. Whitelists  to same-origin paths.
- Signup: pass emailRedirectTo=<APP_URL>/auth/confirm, show a
  'check your email' confirmation state with a resend action (cooldown),
  and handle the already-registered case.
- Login: detect email_not_confirmed and offer a resend-confirmation action;
  surface verification_failed errors from the confirm route.
2026-05-31 20:38:48 +02:00
Gerhard Scheikl 8e8df7ae64 fix(admin): eliminate GoTrue empty-body 500s under bulk load (retry-all + undici keep-alive + sequential bulk), CSV formula-injection guard 2026-05-31 17:30:04 +02:00
Gerhard Scheikl 17fe642168 fix(admin): retry GoTrue admin reads on transient empty-body responses (bulk-load robustness) 2026-05-31 15:35:33 +02:00
Gerhard Scheikl d317e8c758 feat(admin): live redis kill-switch on tunnel actions, sortable columns + CSV export + bulk actions, Node 24 LTS
WS1: pin all Docker stages to node:24.16.0-alpine; add engines node>=20.
WS2: lib/redis.ts gains TTL-backed redisSet, redisDel, setTunnelActive (writes tunnel:active:<sub>=1/0 EX 30, TUNNEL_ACTIVE_TTL override, no-op without REDIS_URL); wired into tunnel active/delete/reassign routes.
WS3: sortable columns, CSV export routes (token excluded), and bulk actions (self-account guard) across users/tunnels/audit admin tables.
2026-05-31 14:46:22 +02:00
Gerhard Scheikl dd0ff39890 fix(admin): return 404 (not 500) when deleting an already-removed user
GoTrue returns an empty body for a missing-user delete, surfacing as an
opaque JSON-parse error; pre-check existence via getUserById for a clean 404.
2026-05-31 13:23:43 +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 61bf6c013c fix(admin): deterministic UTC timestamp formatting to remove hydration mismatch 2026-05-31 12:26:41 +02:00
Gerhard Scheikl b6c4d94990 fix(admin): key tunnels by user_id, server-side initial list load, full-scan user search 2026-05-31 11:46:14 +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