email_guard
email_guard · Supabase Auth signup guard that blocks disposable email domains and normalizes Gmail addresses.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100980 | email_guard | email_guard | 0.35.0 | SEC | Apache-2.0 | SQL |
Usage
Sources:
- Official version 0.35.0 README
- Official version 0.35.0 control file
- Official version 0.35.0 SQL
- Official package page
email_guard provides email normalization, disposable-domain checks, and a Supabase Auth before-user-created hook. Version 0.35.0 blocks disposable addresses and prevents duplicate Gmail identities that differ only by dots, plus-tags, or the googlemail.com alias.
Core Workflow
Install the extension in a stable schema and call its pure helper functions directly:
For Supabase Auth, configure the project’s before-user-created Postgres Function hook to call:
The hook accepts the Auth event as jsonb. It returns an empty JSON object for an allowed signup, an HTTP-style 403 error for a disposable domain, or 409 when the normalized Gmail identity already exists in auth.users. Events without an email, such as phone signup, pass through.
API and Data
normalize_email(text): lowercases/trims email input and canonicalizes Gmail/Googlemail local parts.is_disposable_email_domain(text): checks the seeded blocklist, including parent-domain matches.is_disposable_email(text): extracts the domain and applies the blocklist check.hook_prevent_disposable_and_enforce_gmail_uniqueness(jsonb): Supabase Auth hook.disposable_email_domains: the versioned domain blocklist table.
Caveats
The hook queries auth.users, so it is specific to a Supabase Auth deployment and needs suitable privileges. Its Gmail uniqueness check covers users already present at hook execution time; validate concurrency and error handling in the real signup path. Keep the seeded domain data current by upgrading the extension rather than editing undocumented internals.
The catalog target documented here is 0.35.0. Upstream main has since advanced to 0.36.0, so pin the reviewed version when reproducing these exact functions and blocklist contents.