Security
Sign-up open to anyone: email confirmation, rate limits and CAPTCHA in Supabase Auth
Supabase's sign-up endpoint can be called by anyone who has your project URL and publishable key, and both ship in your front end - so hiding the sign-up page does not close it. Every new account also gets the authenticated role in your database. Below: how to check your own project in the dashboard and the SQL Editor, and the fixes in order: switch sign-up off if you do not need it, keep Confirm email on, send mail through your own SMTP, set rate limits, and add CAPTCHA.
What you are seeing
Open sign-up usually shows up as one of these:
- The user list (Authentication > Users in Supabase, More > Users in Lovable) fills with accounts nobody on your team recognises: random-looking addresses, many from the same domain, created in bursts.
- Real users report
email rate limit exceededor never get their confirmation or password reset email. On the built-in email service the whole project may send 2 emails per hour, and Auth then returns a429with the codeover_email_send_rate_limit(Test auth flows). - Your email provider warns you about your sending reputation or limits your account. Supabase's docs list damaging your sending reputation as one goal of bot sign-ups (Custom SMTP).
- The database grows without a matching growth in real users. With anonymous sign-ins on, Supabase warns that bad actors can abuse the endpoint "to increase your database size drastically" (Anonymous sign-ins).
- Someone asked your AI tool to "turn off email confirmation" while testing, and nobody turned it back on.
How to check it yourself
Check your own project only. Steps 1 and 2 only look at settings. Steps 3 to 5 only read, and run in the Supabase dashboard under SQL Editor. On Lovable's built-in backend (Lovable Cloud) you may not have a SQL Editor; the settings are under More > Users > Settings, and the Users view shows a Signups chart (Lovable: users and authentication).
1. Read the five settings that decide who can sign up
- Allow new users to sign up (Authentication > Sign In / Providers): if it is on, anyone can create an account. Switched off, "only existing users can sign in" (General configuration). In Lovable the setting is called Disable sign-up (Lovable docs).
- Confirm email (in the Email provider on the same page): on hosted Supabase projects it is on by default (Passwords). If it is off, Supabase treats every address as verified and "implicitly confirms the user's email in the database" (General configuration). In Lovable, the same thing is Auto-confirm email under More > Users > Settings > Email, and it should be off for a live app (Lovable: email authentication).
- Allow anonymous sign-ins: if your app has no guest mode, this should be off.
- Enable CAPTCHA protection (Authentication > Attack Protection): it only works after you add a secret key from hCaptcha or Cloudflare Turnstile (CAPTCHA), so a project that never set it up has none.
- SMTP Settings (Authentication > Emails): if no custom SMTP server is set, your project uses Supabase's built-in service, which only delivers to members of your Supabase team and is "not meant for production use" (Custom SMTP).
If you prefer the command line, the Management API returns the same settings. Create a personal access token under Account > Access Tokens, use it, and delete it when you are done - it has full access to your projects.
curl -s "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
| jq '{disable_signup, mailer_autoconfirm, external_anonymous_users_enabled,
security_captcha_enabled, security_captcha_provider, smtp_host, rate_limit_email_sent}'disable_signup: false means anyone can sign up. mailer_autoconfirm: true means Confirm email is off. smtp_host: null means the built-in email service.2. Look at the rate limits
Open Authentication > Rate Limits. The defaults are documented on Rate limits: sign-ups, magic links, OTPs and password resets are limited to 30 requests per 5 minutes per IP address, password sign-ins (the /token endpoint) to 150 per 5 minutes, and emails to 2 per hour on the built-in service. With custom SMTP, Supabase starts you at 30 emails per hour, which you can change on the same page (Custom SMTP). Lovable Cloud lets you change one limit, Rate limit for sending emails, under More > Users > Settings > Email > Advanced; new projects start at 1,000 emails per hour once email sending is active (Lovable: email authentication).
3. Count sign-ups per day
The auth.users table holds every account. email_confirmed_at is empty until the address is confirmed, and is_anonymous is true for anonymous users (Users):
select
date_trunc('day', created_at)::date as day,
count(*) as sign_ups,
count(*) filter (where email_confirmed_at is null) as not_confirmed,
count(*) filter (where last_sign_in_at is null) as never_signed_in,
count(*) filter (where is_anonymous) as anonymous
from auth.users
where created_at > now() - interval '30 days'
group by 1
order by 1 desc;4. Group accounts by email domain
This splits each address at the @ with Postgres's `split_part` and counts accounts per domain:
select
lower(split_part(email, '@', 2)) as email_domain,
count(*) as accounts,
count(*) filter (where email_confirmed_at is null) as not_confirmed,
max(created_at) as latest_sign_up
from auth.users
where email is not null
group by 1
order by accounts desc
limit 25;5. Check what a new account can read
A user who signs up and signs in gets the authenticated Postgres role (API keys), and Supabase notes that anonymous users use it too (Users). So any policy written for authenticated applies to a bot account the moment it exists. List those policies:
select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
and roles && array['authenticated', 'public']::name[]
order by tablename, cmd;qual of true means every signed-in account sees every row of that table. That is a separate problem with its own guide (linked at the bottom), but open sign-up makes it much worse.To see whether many accounts that did sign in came from the same address, the ip column of auth.sessions holds the IP of each session (Audit logs). Offices and mobile networks share IPs, so treat this as a hint, not proof:
select ip, count(distinct user_id) as accounts, max(created_at) as latest_session
from auth.sessions
where created_at > now() - interval '30 days'
group by ip
having count(distinct user_id) > 1
order by accounts desc
limit 20;Why it happens
Sign-up is a public endpoint by design. Your app calls /auth/v1/signup with the project's publishable (or legacy anon) key, and Supabase describes that key as one that "anyone can read" because it ships in the browser or the mobile app (API keys). Removing the sign-up form from your app does not remove the endpoint. Only the Allow new users to sign up setting does.
“A common source of abuse is bots or attackers signing up users to your application.”
According to the same page, the aim is to damage your email sending reputation (sometimes followed by a ransom demand), to block sign-ups and password resets for real users, or to push you into switching off email confirmation. With confirmation off, an attacker can create an account in someone else's name (Custom SMTP). Several defaults and habits make this easy:
- Confirm email gets switched off during development because the confirmation mail does not arrive. Supabase warns that this "lets anyone sign up with an email address they don't own" and also turns off the project's hourly email limit (Test auth flows).
- The built-in email service is shared, limited to 2 emails per hour for the whole project, and only delivers to your team (Custom SMTP). Emails triggered by bots use up the same project-wide limit as your real users (Rate limits).
- The per-IP limits slow down one source, but they are counted per IP address (Rate limits). Supabase calls CAPTCHA "the most effective way to control bots" in this scenario (Custom SMTP), and CAPTCHA needs keys you add yourself.
- Anonymous sign-ins create real rows in
auth.users, and Supabase recommends CAPTCHA for them (Anonymous sign-ins). - Policies written as "any signed-in user" assume that signing in means being a trusted customer. With open sign-up, it only means having an email address.
How to fix it
1. Close sign-up if you do not need it
If your app is internal, invite-only or still in a closed beta, switch off Allow new users to sign up under Authentication > Sign In / Providers. Existing users can still sign in (General configuration). Add people yourself under Authentication > Users; Supabase describes inviting as an admin action done from the Dashboard or from a server with your secret key (Users). In Lovable, turn on Disable sign-up under More > Users > Settings; you can still add users with Add user (Lovable docs). If your app has no guest mode, switch off anonymous sign-ins as well.
2. Keep Confirm email on
Turn Confirm email back on in the Email provider settings (in Lovable: turn off Auto-confirm email). Supabase's own advice on bot sign-ups: "Do not disable email confirmations under pressure" (Custom SMTP). If confirmations do not arrive, the fix is step 3, not switching confirmation off. For a reviewer or demo account, confirm that one account only, not the whole project.
3. Send auth emails through your own SMTP provider
- Create an account with an SMTP provider (Supabase lists Resend, AWS SES, Postmark, Twilio SendGrid, ZeptoMail and Brevo as examples) and enter the host, port, user and password under Authentication > Emails > SMTP Settings (Custom SMTP).
- Set up SPF, DKIM and DMARC for the sending domain with your provider, and send auth emails from their own subdomain (such as
auth.example.com), separate from newsletters (Custom SMTP). - If your provider has link tracking, turn it off for auth emails: Supabase notes it can break confirmation links (Production checklist).
- On Lovable Cloud, set up sending from your own domain under More > Emails (Lovable: email authentication).
4. Set rate limits to what your real traffic needs
In Authentication > Rate Limits, set the email limit to roughly what your real sign-ups and password resets need per hour, with headroom. The limit then caps how many emails bots can trigger. Before a launch or a campaign, raise it in advance and tell your email provider; Supabase notes that sudden spikes can hurt your sending reputation (Custom SMTP).
Sb-Forwarded-For header, which only works with a secret key (Rate limits).5. Add CAPTCHA to sign-up, sign-in and password reset
Supabase supports hCaptcha and Cloudflare Turnstile, and notes that such services can run "invisible challenges where real users won't be asked to solve puzzles most of the time" (Custom SMTP). Create a widget with your provider, copy the site key and the secret key, then under Authentication > Attack Protection turn on Enable CAPTCHA protection, pick the provider and paste the secret key (CAPTCHA). The site key goes into your front end and is public; the secret key stays in Supabase.
Then pass the token from the widget to Supabase. This follows the Turnstile example in Supabase's docs (npm install @marsidev/react-turnstile), with a reset after each attempt, because a fresh challenge is needed for the next try:
import { useRef, useState, type FormEvent } from "react";
import { Turnstile, type TurnstileInstance } from "@marsidev/react-turnstile";
import { supabase } from "./supabaseClient"; // your existing client
export function SignUpForm() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [captchaToken, setCaptchaToken] = useState<string>();
const [message, setMessage] = useState<string>();
const captcha = useRef<TurnstileInstance | undefined>(undefined);
async function handleSubmit(event: FormEvent) {
event.preventDefault();
const { error } = await supabase.auth.signUp({
email,
password,
options: { captchaToken },
});
captcha.current?.reset();
setCaptchaToken(undefined);
setMessage(error ? error.message : "Check your inbox to confirm your email.");
}
return (
<form onSubmit={handleSubmit}>
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} />
<Turnstile
ref={captcha}
siteKey={import.meta.env.VITE_TURNSTILE_SITE_KEY}
onSuccess={setCaptchaToken}
/>
<button type="submit" disabled={!captchaToken}>Sign up</button>
{message && <p>{message}</p>}
</form>
);
}import.meta.env.VITE_... is for Vite projects. In Next.js use a NEXT_PUBLIC_ variable instead.Supabase's CAPTCHA covers sign-in, sign-up and password reset (CAPTCHA), so give the other forms a widget too and pass the token the same way:
await supabase.auth.signInWithPassword({ email, password, options: { captchaToken } });
await supabase.auth.resetPasswordForEmail(email, { captchaToken });
// Only if your app uses guest mode:
await supabase.auth.signInAnonymously({ options: { captchaToken } });captcha_failed (Error codes). Mobile apps need the provider's mobile integration, which this guide does not cover.6. Optional: reject sign-ups from domains you have seen abused
The Before User Created hook runs before an account is created and can refuse it - Supabase's examples block email domains, OAuth providers or IP ranges. It is available on the Free and Pro plans (Auth Hooks). This version keeps the blocked domains from step 4 of the check inside the function, so there is no extra table to protect. The grants follow Supabase's docs: only the Auth server (supabase_auth_admin) may run it, and the API roles may not.
create or replace function public.hook_block_signup_domains(event jsonb)
returns jsonb
language plpgsql
set search_path = ''
as $$
declare
email_domain text := lower(split_part(event->'user'->>'email', '@', 2));
begin
if email_domain = any (array['first-blocked-domain.com', 'second-blocked-domain.net']) then
return jsonb_build_object(
'error', jsonb_build_object(
'http_code', 403,
'message', 'Please sign up with a different email address.'
)
);
end if;
return '{}'::jsonb;
end;
$$;
grant usage on schema public to supabase_auth_admin;
grant execute on function public.hook_block_signup_domains(jsonb) to supabase_auth_admin;
revoke execute on function public.hook_block_signup_domains(jsonb) from authenticated, anon, public;hook_block_signup_domains.A domain list only stops what you have already seen. Use it next to CAPTCHA, not instead of it.
7. Clean up the fake accounts
Supabase allows deleting users directly or under Authentication > Users (Managing user data). Look at the list first. An unconfirmed account can also be a real person whose confirmation email never arrived, which is likely if you were on the built-in email service, so do this after step 3 and keep a backup. The invited_at is null condition keeps people you invited but who have not accepted yet:
select id, email, created_at
from auth.users
where email_confirmed_at is null
and last_sign_in_at is null
and invited_at is null
and created_at < now() - interval '7 days'
order by created_at;When the list contains only accounts you want gone, run the same filter as a delete. Rows in your own tables that reference auth.users with on delete cascade are removed with them, and a user who owns files in Storage cannot be deleted until those files are removed (Managing user data):
delete from auth.users
where email_confirmed_at is null
and last_sign_in_at is null
and invited_at is null
and created_at < now() - interval '7 days';delete from auth.users where is_anonymous is true and created_at < now() - interval '30 days'; (Anonymous sign-ins).Verify
- Sign up in your app with a new address of your own: the confirmation email arrives from your domain, and the account cannot sign in until you click the link (with sign-up switched off you should get the error code
signup_disabledinstead, Error codes). - Sign in and reset a password through the app: both still work with CAPTCHA on.
- If you added the hook, temporarily add a domain you control to the list, try to sign up with it, and check that the sign-up is refused. Then take it out again.
- Rerun step 3 of the check over the following days.
When to get help
For a small app, the settings above take an afternoon. Get a second pair of eyes when:
- Bot accounts already signed in, and your policies let any signed-in user read data (step 5 of the check found
truepolicies). Then the question is what they could reach, not only how to stop them. - Your email provider has restricted your account, or confirmation and reset emails are not reaching real users and you cannot tell why.
- Sign-up runs through server code, Edge Functions or a mobile app where CAPTCHA and IP forwarding are harder to wire up.
- Sign-up unlocks something of value - free credits, a trial, AI calls you pay for - so every fake account costs you money.
Sources
Primary documentation this guide was checked against. Platforms change - if something here no longer matches, the source wins.
- General configurationSupabase docs
- Password-based AuthSupabase docs
- Rate limitsSupabase docs
- Enable CAPTCHA protectionSupabase docs
- Send emails with custom SMTPSupabase docs
- Test auth flowsSupabase docs
- Error codesSupabase docs
- UsersSupabase docs
- Managing user dataSupabase docs
- Anonymous sign-insSupabase docs
- Auth audit logsSupabase docs
- Auth HooksSupabase docs
- Before User Created hookSupabase docs
- API keysSupabase docs
- Production checklistSupabase docs
- Management API: get auth configSupabase docs
- String functions (split_part)PostgreSQL docs
- Users and authenticationLovable docs
- Email authenticationLovable docs
Frequently asked questions
- I removed the sign-up page. Can people still sign up?
- Yes. The sign-up endpoint belongs to Supabase Auth, not to your page, and it accepts requests made with your publishable key, which is in your front end. Switch off Allow new users to sign up in Authentication > Sign In / Providers (in Lovable: Disable sign-up) to actually close it.
- Users get "email rate limit exceeded". Should I turn off Confirm email?
- No. The built-in email service sends 2 emails per hour for the whole project and is not meant for production. Set up your own SMTP provider and raise the email limit under Authentication > Rate Limits. Turning off Confirm email lets anyone sign up with an address they do not own.
- Don't Supabase's rate limits already stop bots?
- They slow down a single source: sign-ups are limited per IP address, 30 requests per 5 minutes by default. They do not tell a person from a script. Supabase calls CAPTCHA the most effective way to control bot sign-ups.
- Will CAPTCHA annoy my real users?
- Usually not much. Supabase supports hCaptcha and Cloudflare Turnstile and notes that such services can run invisible challenges where most real users never see a puzzle. Test the whole flow on a phone before you ship.
- Is this a problem if my policies are correct?
- Less so, but it still costs you. Fake accounts use up your email limit and sending reputation, can block real users from signing up or resetting passwords, and grow your database. And any policy written for any signed-in user applies to every fake account too.
- How do I do this on Lovable Cloud?
- Under More > Users > Settings: Disable sign-up to close sign-up, keep Auto-confirm email off, and set Rate limit for sending emails under Email > Advanced. Set up sending from your own domain under More > Emails. The Lovable pages on authentication and email auth linked above do not mention a CAPTCHA setting, so ask Lovable support before relying on one.
Related guides
Fixed-price audit
Want someone to check the whole app, not just this?
A review of data security, production readiness and App Store readiness for apps built with AI tools. 900 USD, a ranked list of fixes within 5 business days.