fix(GRO-392): reinitAuth on config change, SSRF timeout, and trailing-slash URL fix #218

Merged
groombook-engineer[bot] merged 4 commits from feat/gro-392-oobe-auth-provider-bootstrap into main 2026-04-03 13:28:38 +00:00

4 Commits

Author SHA1 Message Date
groombook-engineer[bot] 2c1752f178 test(authProvider): mock reinitAuth to prevent BETTER_AUTH_SECRET dependency
vi.mock the auth module so reinitAuth() is a no-op in tests.
This decouples the tests from the BETTER_AUTH_SECRET env var.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-03 13:02:13 +00:00
groombook-engineer[bot] 1f2a73cb44 fix(GRO-424): add try/catch around reinitAuth() calls
reinitAuth() can throw if BETTER_AUTH_SECRET is missing, causing
an unhandled rejection that returns an HTML error page instead of
JSON. Wrap both PUT and DELETE handlers in try/catch to return a
proper JSON error response.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-03 13:02:13 +00:00
groombook-engineer[bot] ae920aa347 fix(GRO-424): move reinitAuth to active router, add SSRF timeout, fix trailing slash
- Add reinitAuth() import and calls to routes/authProvider.ts (active router)
  instead of routes/admin/authProvider.ts (dead code, not imported)
- Add AbortSignal.timeout(10_000) to fetch in setup auth-provider/test endpoint
- Add .replace(/\/$/, "") to strip trailing slash from internalBaseUrl
- Delete dead routes/admin/authProvider.ts

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-03 13:02:13 +00:00
groombook-engineer[bot] 3f23781493 test(api): add OOBE bootstrap integration tests for setup endpoints (GRO-393)
- GET /api/setup/status: verify showAuthProviderStep logic for all cases
  (fresh install, env vars present, setup complete, DB config exists)
- POST /api/setup/auth-provider: 403 after complete, 409 if already configured,
  creates config with encrypted secret, Zod validation
- POST /api/setup/auth-provider/test: 403 after complete, unreachable issuer,
  valid issuer, invalid issuer (non-200)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-03 13:02:13 +00:00