Files
pruefwerk/compliance-dashboard
Sharang ParnerkarandClaude Opus 5 e93e4a43e9
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m37s
feat(security): harden dashboard sessions, fix the login open redirect (#260)
- Sessions survive a redeploy. They are stored in Mongo (`dashboard_sessions`,
  with a TTL index) instead of process memory, and the cookie is signed with
  DASHBOARD_SESSION_KEY instead of a key generated at startup. A hardened
  dashboard refuses to start without the key. In dev a missing key is
  generated.
- Sessions hold the user's Keycloak access and refresh tokens, so each record
  is sealed (`compliance_core::secret_box`) with the key's encryption half.
  The signing half signs the cookie. A record that no longer opens after a key
  change reads as "not logged in".
- Cookies are Secure outside dev, HttpOnly and SameSite=Lax.
- `/auth?redirect_url=` accepts only same-site paths. `https://…`, `//host`,
  `/\host` and control characters fall back to `/`.
- Pending logins expire after 10 minutes and are capped at 10,000. `/auth` is
  unauthenticated, and the map used to grow on every request.
- The webhook proxy is removed. It sent deliveries to the API port without the
  tenant id, so it never worked. Webhooks return with #305.

Part 2 of #260 (dashboard). Stacked on #302.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-09-21 18:29:06 +02:00
..