Require email verification for every new signup #393
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 563 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.379
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #393"
general
weight: 0.35
ethanteng
Why
Spam signups. The six-digit code has been optional since it shipped in Aug 2025, because "Skip for now" got past it. Since Oct 3, 2026 (
f113759a), a calculator run handed straight from its results page has skipped the code entirely. Nothing on the server checkedemailVerified, so a script could post to/auth/registerunder any address. Each such signup started a 30-day Stripe trial and joined the MailerLite trial group, whose welcome sequence then went to an inbox that never signed up.What changes
User.emailVerificationPendingis set at registration and cleared by the code. While it's set,authenticate()returns403 EMAIL_NOT_VERIFIED.- It lets through only the verification endpoints,
GET /auth/profile, logout, the calculator-lead attach, and billing.- The three code endpoints also accept a lapsed subscription. A paid signup that is canceled before entering its code can still verify, then renew.
-
adminAuthreads the account behind the session's address and refuses it while pending. Before, anyone could register anADMIN_EMAILSaddress that had no account yet and use the admin pages at once.- The no-card trial grant and the MailerLite join wait for the code.
POST /auth/verify-emailclaims the code, runsactivateVerifiedSignup, and only then clears the flag.- A pending account can't start a Checkout. Because the flag clears last, that stays true while the trial grant is still running, so a Checkout can't be finished beside the trial and bill twice.
/subscribesends that refusal to the code page.- The nightly
mailerlite-syncskips pending accounts.- This reverses the registration-time subscribe kept in
746ac0f7, at the owner's request.- A lead token that only ever reached its own inbox still counts as proof, so that signup skips the code.
- A token that was handed back to the results page now gets a code. Its run is still saved as the first decision and opens once the code is in.
-
acceptsFirstDecisionHandoffis ignored.-
/auth/verify-emailallows 10 tries per account per code lifetime.- A code can be used once only, and is looked up only within the signed-in account.
- Both send endpoints wait a minute between codes.
- A new code that collides with a live one is drawn again.
-
/app, sign-in and the signed-in header send a pending session to/verify-email?send=1, which mails one fresh code. Sign-in does this before it looks at the subscription.- The verify page shows the address the code went to, has one "Send a new code" button and a "Wrong address? Sign out" link, and offers no skip to a new signup.
- Calculator and signup copy no longer promises "no code".
Full write-up:
docs/EMAIL_VERIFICATION.md. CLAUDE.md and the calculator and funnel docs are updated to match.Review follow-ups (9c931107)
- The admin check now reads the account.
- The stale
tokenDisclosedcomments in the two leads services are corrected.- The saved-run copy now says a code may be emailed. Only the server knows whether the token already proved the address.
Deploy
20261129120000_add_email_verification_pending(a non-null boolean, default false) before the backend starts. Every authenticated query reads the column.ADMIN_EMAILSalready has a verified account.Not covered
Bots can still create user rows and still receive the code email. Only a challenge on the signup form, such as Cloudflare Turnstile, would stop that.
Testing
All run locally against Postgres with CI's environment, with
GITHUB_RUN_IDset so the network-gated suites run too:test:real-security: 28 passed.test:security: 39 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01DchAE7UPyYYujQjmL7SXwo