---
title: "Discussion on \"Your AI-built app's signup is open to anyone who calls the API\" | Hashnode"
description: "Discussion on \"Your AI-built app's signup is open to anyone who calls the API\". A six-step checklist for Lovable, Bolt and Cursor apps on Supabase: sign up without your UI, test Row Level Security, normalise contact details, and move the rules into a hook."
url: "https://hashnode.com/posts/your-ai-built-app-s-signup-is-open-to-anyone-who-calls-the-api/6ac6026a1d96f574c0c6e600"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Your AI-built app's signup is open to anyone who calls the API](https://elijahbrown.hashnode.dev/your-ai-built-app-s-signup-is-open-to-anyone-who-calls-the-api?utm_source=hashnode&utm_medium=feed)

A six-step checklist for Lovable, Bolt and Cursor apps on Supabase: sign up without your UI, test Row Level Security, normalise contact details, and move the rules into a hook.

Oct 7 · 10 min read · elijahbrown.hashnode.dev  
Read the article

-   [#supabase](https://hashnode.com/tag/supabase)
-   [#lovable](https://hashnode.com/tag/lovable)
-   [#security](https://hashnode.com/tag/security)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#authentication](https://hashnode.com/tag/authentication)

## Written by

[Elijah Brown](https://hashnode.com/@elijahbrown)

@elijahbrown · Dubai, UAE

  
[View profile](https://hashnode.com/@elijahbrown)

Building Orisift. Writing about DNS, phones and forms.

I'm building Orisift, a developer API that checks phone numbers, email domains and IP addresses against reference data, and says what it couldn't find out. I write about the small standards details that decide how forms behave.

## Responses 2

Markdown supported · ⌘↵ to post

[Mike Dabydeen](https://hashnode.com/@firelinks)

[Oct 7](https://hashnode.com/posts/your-ai-built-app-s-signup-is-open-to-anyone-who-calls-the-api/6ac6026a1d96f574c0c6e600/comment/6ac62b138af1e2443c07b46c)

The step 6 hook works, but I'd change how it finds the duplicate before relying on it. Wrapping auth.users.email in public.normalise\_email() means Postgres can't use the email index, so every signup scans the whole users table. Supabase gives Postgres hooks 2 seconds, so past some user count the check starts timing out and blocking real signups along with the repeats.

It also has a race. Two signups for Your.Name+a and Your.Name+b sent at the same moment both run the exists query before either user row is committed, and both get through.

A table you own fixes both. Give public.signup\_keys the normalised email as its primary key, and have the hook run insert ... on conflict do nothing and refuse when no row went in. The primary key is the index, and a second insert of the same key waits for the first and then conflicts. The trade is that a key can stay behind if account creation fails after the hook, so someone needs a way to clear it. It's your trial\_claims idea from step 4, moved one step earlier.

[Elijah Brown](https://hashnode.com/@elijahbrown)

[Oct 7](https://hashnode.com/posts/your-ai-built-app-s-signup-is-open-to-anyone-who-calls-the-api/6ac6026a1d96f574c0c6e600/comment/6ac62b138af1e2443c07b46c#reply-6ac63690a6013ae9a0e7b272)

You're right on both, thanks Mike. Wrapping the column in a function means the email index can't help, and two concurrent exists checks can both pass before either user row commits.

I'm changing step 6 to the table you describe: the normalised email as the primary key, insert on conflict do nothing in the hook, and refuse when no row went in. I'll add a backfill from existing users and a note on clearing a key when account creation fails, or when someone deletes their account and should be allowed back. The Lovable prompt gets the same change.
