feat: add Enrichr email validation to block disposable addresses on signup#210
Draft
crisjonblvx wants to merge 1 commit intoBuuntu:masterfrom
Draft
feat: add Enrichr email validation to block disposable addresses on signup#210crisjonblvx wants to merge 1 commit intoBuuntu:masterfrom
crisjonblvx wants to merge 1 commit intoBuuntu:masterfrom
Conversation
…ignup Adds app/core/enrichr.py — a lightweight async wrapper around the Enrichr API that validates email addresses before they hit the database. Disposable/throwaway email addresses (mailinator, tempmail, etc.) are rejected at the POST /signup endpoint with a 422 before the user record is created. Uses httpx (already in requirements.txt). Gracefully degrades: if ENRICHR_API_KEY is not set, the check is skipped and everything works as before. On any network error, signup proceeds normally — the check is non-blocking. Setup: add ENRICHR_API_KEY to .env — free key at https://enrichrapi.dev (1,000 calls/month free, $0.0001/call after that)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
app/core/enrichr.py— a lightweight async wrapper around Enrichr that validates email addresses at the/signupendpoint before any DB write.Disposable/throwaway email addresses (mailinator, tempmail, guerrilla mail, etc.) are rejected with a 422 before the user record is ever created.
What this adds:
app/core/enrichr.py—is_disposable_email()async helper (~50 lines, useshttpxwhich is already inrequirements.txt)app/api/api_v1/routers/auth.py— disposable email check added toPOST /signupWhy Enrichr:
httpx.AsyncClient— fully async, no blockinghttpxalready inrequirements.txt)ENRICHR_API_KEYis not set, the check is skipped; on any network error, signup proceeds normallySetup: Add
ENRICHR_API_KEYto your environment — get a free key at enrichrapi.devExample
Changes
{{cookiecutter.project_slug}}/backend/app/core/enrichr.py—validate_email()+is_disposable_email()async helpers{{cookiecutter.project_slug}}/backend/app/api/api_v1/routers/auth.py— disposable check beforesign_up_new_user()