feat: add Enrichr email validation to block disposable addresses on signup#2195
Draft
crisjonblvx wants to merge 1 commit intofastapi:masterfrom
Draft
feat: add Enrichr email validation to block disposable addresses on signup#2195crisjonblvx wants to merge 1 commit intofastapi:masterfrom
crisjonblvx wants to merge 1 commit intofastapi:masterfrom
Conversation
…ignup Adds backend/app/enrichr.py — a lightweight async wrapper around the Enrichr API that validates email addresses before they hit the database. Disposable/throwaway email addresses (mailinator, guerrilla mail, etc.) are rejected at the /users/signup endpoint with a 422 before the user record is created. 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
backend/app/enrichr.py— a lightweight async wrapper around Enrichr that validates email addresses before they're saved to the database.Disposable/throwaway email addresses (mailinator, tempmail, guerrilla mail, etc.) are rejected at
POST /api/v1/users/signupwith a 422 before the user record is ever created.What this adds:
backend/app/enrichr.py—is_disposable_email()async helper (~55 lines, useshttpx)backend/app/api/routes/users.py— oneawait is_disposable_email()call inregister_user.env—ENRICHR_API_KEY=placeholderWhy Enrichr:
httpx.AsyncClient— fully async, no blockingENRICHR_API_KEYis not set, the check is skipped; on any network error, signup proceeds normallyhttpxis already in the project)Setup: Add
ENRICHR_API_KEYto.env— get a free key at enrichrapi.devExample
Changes
backend/app/enrichr.py—validate_email()+is_disposable_email()async helpersbackend/app/api/routes/users.py—register_usermadeasync, disposable check added.env— addedENRICHR_API_KEY=placeholder