Guides For foundersSupabaseSecurity
We read 10 apps built with AI tools. Here's what was actually wrong.
Not leaked keys. Rules that looked right and weren't.
Most warnings about apps built with AI tools say the same thing: the AI pastes a secret key into the browser and anyone can take it. So I went looking for it. I read ten real, public apps built with Lovable and similar tools on Supabase: a property platform taking payments, a bar's till, an HR system, a booking SaaS with hundreds of tables. Not one leaked an admin key.
What I found instead was quieter, and in two of the ten, worse.
How I looked
Only public code. For each app I read the code and its full history, and replayed every database migration in order to work out the access rules as they finally stand. A scanner flagged candidates; I checked every one by hand and threw most of them out. I didn't touch, test or log in to any live app. Each owner with a serious problem heard from me privately first, and nothing here identifies an app.
The ten between them had 464 database tables. In the median app, 96% of the commits were made by the AI tool itself.
The headline
- 4 of 10 had at least one serious problem (critical or high). 2 had a critical one: customer data readable by anyone, or a user able to make themselves an admin.
- 0 of 10 leaked an admin key. Every key in the code was the public one, which is meant to be public.
- 6 of 10 had nothing serious. The best had 201 test files and shared checks for who is calling, used across its server functions. Built with AI is not the same as broken.
- 4 of 10 had no automated tests at all.
The problems weren't random. They fell into five patterns.
1. Storage is the forgotten half
Two apps stored financial documents in storage that outsiders could reach. In one, the bucket of customer payment receipts was private, but a single rule called "Public Access" opened it again: anyone could list and download every file. In the other, affiliate payout receipts sat in a public bucket, so anyone with a file's link could download it.
Most security advice, mine included, talks about database tables. File storage has its own rules, and AI tools write them in a hurry when you ask for an upload button[4].
Check: in Supabase, open Storage, then Policies. Any read rule whose only condition is the bucket name lets anyone holding your public key read every file in it.
2. Rules that check whose row it is, not what changes
One app let every signed-in user update their own row in the roles table. Sensible-sounding: it's their row. But the row holds their role, and nothing checked what they changed it to. Any user could make themselves a super admin, and every admin check in the app trusted that table.
Check: for any table holding a role, plan, credit balance or approval status, can a user update their own row? If so, which columns can they change?
3. Policy names lie
The name of a rule is just a label the AI wrote. "Admins manage tasks" in one app had, after a later change, a condition of true: any signed-in user could read, edit or delete the admin task list. "Authenticated users can view courses" in another was open to everyone, signed in or not. That one was harmless (a golf course's phone number), but the pattern isn't.
Check: read the condition, not the name. USING (true) means everyone the rule applies to.
4. Views and functions that skip the rules
Two apps had database views, which are saved queries, that quietly ignored the table rules underneath them. In Postgres a view runs with its creator's rights unless it's told otherwise[1]. One exposed a company's sales records (property, price, broker) to anyone with the public key.
Several apps also had privileged functions without a fixed search path, a smaller hole of the same kind[2][3].
Check: every view needs security_invoker = true. Every SECURITY DEFINER function needs SET search_path, and ideally REVOKE EXECUTE ... FROM public.
5. Server functions that trust whoever calls
Supabase lets you turn off the login check on a server function, and AI tools do it whenever something outside needs to call in: a payment provider, a scheduler, a public form. Then the function has to check the caller itself[5]. Several didn't:
- a payment webhook that marked bookings paid on any message saying "sale complete";
- a function that sent the app's branded email to any address, with any name in it;
- a public AI chatbot with no limit, so anyone could run up the owner's bill.
Check: list your functions with verify_jwt = false. Each one needs its own check: a signature from the payment provider, a shared secret, or a token it issued.
What the good ones did differently
The well-built apps weren't written by hand. They were AI-built too, with three habits:
- they kept a few shared helpers for "who is calling?" and used them in every function;
- they revoked public access to their privileged database functions;
- they had tests, which suggests someone was asking the AI to prove things, not just build them.
The five checks at a glance
| Pattern | Apps | Where to look |
|---|---|---|
| Storage rules | 2 | Storage, then Policies: read rules that only check the bucket name |
| Self-updatable roles | 1 | Tables holding a role, plan or balance that users can update |
| Policy names that lie | 2 | Conditions of true, whatever the rule is called |
| Views and functions | 2+ | Views without security_invoker; definer functions without a search path |
| Open server functions | several | Functions with verify_jwt = false and no check of their own |
Check yours
Start with Check your Supabase app's security in 15 minutes, then add the five checks above: storage rules, self-updatable roles, conditions not names, views, and open functions. The free 30-second check tests whether your tables can be read with the public key; storage, views and functions still need checking by hand. If any of them turns up something you don't understand, that's the point to get a second pair of eyes on it.
Sources
Official documentation
- PostgreSQL. CREATE VIEW. www.postgresql.org/docs/current/sql-createview.html (security_invoker)
- PostgreSQL. CREATE FUNCTION: writing SECURITY DEFINER functions safely. www.postgresql.org/docs/current/sql-createfunction.html
- Supabase. Database functions: security definer vs invoker. supabase.com/docs/guides/database/functions
- Supabase. Storage access control. supabase.com/docs/guides/storage/security/access-control
- Supabase. Function configuration. supabase.com/docs/guides/functions/function-configuration (verify_jwt)
Method
static review of public repositories, October 2026, using the Holdfast audit tooling. Findings describe the code as published; live systems may differ. If you own one of these apps, you've already heard from me privately. The full method and anonymised findings are recorded in Holdfast's research register.
Robert Udah is principal engineer at Holdfast, which runs fixed-fee rescue audits for apps built with AI tools and technical due diligence for buyers of small software businesses. How the audit applies to AI-built apps.