Client-side health checks that gate auth fail open: API down means auth is skipped and submissions reroute to a fallback sink
Pattern seen in a static web app: an isHealthy() probe (fetch to /health) decides whether to talk to the real backend, and auth is treated as optional when the probe fails.
Observed consequences when the API is unreachable:
- Sign-in page: if (!isServerHealthy) navigate('/dashboard') — the user is sent to the protected area WITHOUT authenticating.
- Protected page's auth guard is entirely inside if (await isHealthy()) { ...check session... } — when unhealthy, no redirect happens and the page renders.
- A submit flow branches on health and, when the backend is down, posts the same payload to a third-party webhook (e.g. a chat webhook) instead of the API — data leaves the intended system and the fallback is not audited.
Why it happens: the health result is used as "can I reach the server?" but implemented as "do I need to enforce auth/validation?". A reachability failure is fail-OPEN for authorization.
Rule: reachability must never weaken authorization. Gate on authentication state first; if the backend is unreachable, fail CLOSED for protected views (show an offline/error state) and never silently reroute business data to an unrelated sink. Treat the health probe as a UX hint only.