Security Warning: Environment-Specific Authentication
CRITICAL: APP_ENV=dev MUST NEVER be deployed to any public-facing environment
WhenAPP_ENV=dev, the application registers a zero-authentication bypass at /dev-sign-in that grants full dashboard access without any credentials. This is intentional for local development but represents a complete authentication bypass if deployed publicly.
What happens in each environment
| Environment | Auth Method | Security Level | Deployable? |
|---|---|---|---|
APP_ENV=dev | Mock auth bypass at /dev-sign-in + Clerk | ZERO AUTH — anyone can enter | NO — local only |
APP_ENV=test | Clerk + email allowlist gate | Restricted to approved testers | Yes (staging) |
APP_ENV=prod | Clerk only (standard) | Full production auth | Yes |
Dev mode bypass details
WhenAPP_ENV=dev:
/dev-sign-inpage is registered — allows instant sign-in as demo user with no credentialsAuthState.post_authacceptsMockAuthState.is_authenticated— skips the Clerk redirect for mock-authed sessions- Protected page content wrapper shows content when
MockAuthState.is_authenticatedis True — bypassesClerkState.is_signed_in - No rate limiting, no CAPTCHA, no verification on the mock sign-in
How to verify your deployment is safe
CI/CD safeguards
The GitHub Actions workflow (.github/workflows/deploy.yml) maps branches to environments:
main→APP_ENV=PRODtest/dev-*→APP_ENV=TEST
APP_ENV=dev is never set in CI/CD. It exists only in envs/dev which is gitignored.
Test environment protections
WhenAPP_ENV=test:
- Email allowlist gate in
AuthState.sync_auth_state— only emails inADMIN_USER_EMAILSenv var (plus hardcodedmymm.psu@gmail.comandnikhil.yadala@gmail.com) can access - Unauthorized users are signed out via
Clerk.signOut()with “Access restricted” message /dev-sign-inpage is NOT registered (only registered whenis_dev()returns True)
Files involved
| File | Dev behavior |
|---|---|
pages/user/dev_sign_in.py | Registers /dev-sign-in page only when is_dev() |
states/shared/mock_auth.py | MockAuthState.dev_sign_in — sets auth without Clerk |
states/shared/clerk_auth.py | post_auth checks MockAuthState in dev before redirecting |
components/layout/page_wrapper.py | Content wrapper accepts MockAuthState in dev |