Files
Nexus/apps/web
Hartmutandclaude-flow f2910b0d0e fix(auth): fail fast when the auth secret is missing, in any environment
A dev server started from apps/web never loads the monorepo root .env, so it
came up with no AUTH_SECRET/NEXTAUTH_SECRET at all. getRuntimeEnvViolations()
returned early for every non-production NODE_ENV, so nothing complained —
Auth.js then answered *every* /api/auth/* route with an opaque 500 ("problem
with the server configuration"). The login form swallowed that silently and
bounced the user back to itself with no error, pointing nowhere near the cause.

Two checks now run regardless of NODE_ENV:

- An auth secret must be present. Its absence is fatal everywhere, because
  without it Auth.js cannot sign session JWTs and nothing about auth works.
  The production-only strength rules (length, entropy, known placeholders)
  are unchanged — a weak secret still only fails production.
- E2E_TEST_MODE must not be "true" when the deployment URL is https. An https
  URL means the instance is reachable off the machine whatever NODE_ENV says,
  and that flag disables login rate limiting and the concurrent-session
  registry. The production case stays with getDevBypassViolations().

assertSecureRuntimeEnv() can now fire outside production, so its message drops
the inaccurate "production".

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-09-11 16:21:29 +02:00
..