* Reject env combinations that are individually valid but operationally * dangerous when paired with `NODE_ENV=production`. Today: the e2e * test-only auth helpers (force-verify a user, mint a raw reset token * bypassing email) must never be reachable in prod. The env schema * accepts the boolea
(env: Env)
| 67 | * live. The list grows as new test/debug flags appear (any env var |
| 68 | * named `*_TEST_*` or `*_DEBUG_*` should land here too). |
| 69 | */ |
| 70 | function checkProdSafeFlags(env: Env): string[] { |
| 71 | if (env.NODE_ENV !== "production") { |
| 72 | return []; |
| 73 | } |
| 74 | |
| 75 | const violations: string[] = []; |
| 76 | |
| 77 | if (env.E2E_TEST_ENDPOINTS_ENABLED) { |
| 78 | violations.push( |
| 79 | "E2E_TEST_ENDPOINTS_ENABLED is true in production. The /__test auth helpers (force-verify, raw reset token) must never be reachable in prod — unset the variable or set it to false." |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | return violations; |
| 84 | } |
| 85 | |
| 86 | /** |
no outgoing calls
no test coverage detected