Stop Fake Accounts Before They Write to Supabase auth.users
Intercept registration synchronously using Supabase "Before User Created" Edge Function hooks. SiftlyAPI screens email, network, and velocity reputation in 10-40ms and aborts database writes on confirmed threats.
Execution Sequence (Under 40ms)
User registers via supabase.auth.signUp().
Deno function calls SiftlyAPI in 10-40ms.
block aborts with HTTP 400; allow commits to database.
Why Supabase Teams Choose SiftlyAPI
Block fraudulent accounts before they write a single row to auth.users or trigger downstream database triggers.
Official copy-paste Deno recipe with automated client IP extraction and fail-open timeout guarantees.
Map suggested_user_message directly to the Supabase Auth client to guide users to use real business addresses.
If external networks experience transient latency, the hook gracefully allows valid users through.
Drop-In Supabase "Before User Created" Hook
supabase/functions/siftlyapi-signup-guard/index.ts
1import { serve } from "https://deno.land/std@0.168.0/http/server.ts";2
3serve(async (req) => {4 const { user, metadata } = await req.json();5
6 // Extract client IP and fail open if absent (avoids bogon block on 127.0.0.1)7 const clientIP =8 metadata?.ip_address || req.headers.get("x-forwarded-for")?.split(",")[0]?.trim();9 if (!clientIP) {10 return Response.json({});11 }12
13 const res = await fetch("https://api.siftlyapi.com/v1/score-signup", {14 method: "POST",15 headers: {16 "X-API-Key": Deno.env.get("SIFTLYAPI_KEY")!,17 "Content-Type": "application/json",18 },19 body: JSON.stringify({20 email: user.email,21 ip_address: clientIP,22 }),23 });24
25 const { action, suggested_user_message, suggested_http_code } = await res.json();26
27 if (action === "block") {28 // Abort user creation before any row is written to auth.users29 return Response.json(30 { error: { message: suggested_user_message || "Signup blocked due to security risk." } },31 { status: suggested_http_code || 400 }32 );33 }34
35 return Response.json({});36});Start Protecting Supabase Signups
500 free requests per month. Test in staging using 7-day shadow audit mode with 100% pass-through.