Free checklist · v1.0, November 2026 · 12 of 28 checks are critical
The 28 checks I run before a Lovable app takes real payments.
Each one has a test you can run yourself in a few minutes. Free. No email required to read it.
Your data: who can read and write it
Most real leaks in AI-built apps are here. The public key in your website lets anyone talk to your database directly, so the database itself has to say no.
- Check 01 of 28Critical
RLS is enabled on every table in the public schema
- Check
- Supabase dashboard → Database → Advisors. Any "RLS Disabled in Public" (lint 0013) error fails this item.
- Fix
alter table public.<name> enable row level security;then add policies. Never switch RLS off to make an error go away.
- Check 02 of 28Critical
No policy is "using (true)" on data that belongs to someone
- Check
- Run:
select tablename, policyname, qual, with_check from pg_policies where schemaname = 'public' and (qual = 'true' or with_check = 'true'); - Fix
- Compare the owner column with
(select auth.uid()), or check membership in the row's workspace.
- Check 03 of 28Critical
Two test users in different workspaces cannot see each other's rows
- Check
- Run the free two-user leak test (
tools/leak-test), or sign in as user B and open user A's record URLs. - Fix
- Fix the policy on every table that leaks. Add the two-user test to CI so it stays fixed.
- Check 04 of 28Critical
Users cannot write columns they should not control
- Check
- As a normal user, try to update your own role, plan,
is_paidor another user'suser_idfrom the browser console. - Fix
- Add
WITH CHECKto insert and update policies, guard sensitive columns with a trigger or column grants, and move status changes server-side.
- Check 05 of 28Critical
No policy trusts user_metadata
- Check
select * from pg_policies where qual ilike '%user_metadata%' or with_check ilike '%user_metadata%';(lint 0015)- Fix
- Any user can edit their own
user_metadata. Keep roles in a table only the server writes, or inapp_metadata.
- Check 06 of 28High
Views and SECURITY DEFINER functions do not bypass RLS
- Check
- Advisors lints 0010 (security definer view), 0028 and 0029 (definer functions executable by anon or authenticated), 0002 (
auth.usersexposed). - Fix
- Use
security_invokerviews, revoke execute from anon, check membership inside definer functions, and setsearch_path = ''.
- Check 07 of 28High
Storage buckets are private unless the files are truly public
- Check
- Dashboard → Storage. Lint 0025 flags public buckets that allow listing.
- Fix
- Private bucket, per-user folder policies, signed URLs for downloads.
Keys and secrets
The anon (publishable) key is meant to be public. Everything else must live only on a server.
- Check 08 of 28Critical
The service_role / sb_secret_ key is not in the frontend bundle or the repo
- Check
- Build the app, then search the output:
grep -r "service_role\|sb_secret_" dist/. Decode anyeyJ...strings and check the role. - Fix
- Move admin actions to an Edge Function or server route. Rotate the key if it was ever shipped.
- Check 09 of 28Critical
No secret sits in a VITE_ or NEXT_PUBLIC_ variable
- Check
- List every
VITE_/NEXT_PUBLIC_variable. Each one is public by definition. - Fix
- Rename and move to server-side environment variables (Edge Function secrets, Worker secrets).
- Check 10 of 28Critical
OpenAI, Stripe secret and email API keys are only used server-side
- Check
- Search the bundle for
sk-,sk_live_,sk_test_,re_,whsec_. - Fix
- Proxy the call through a function that checks the user, with a per-user rate limit.
- Check 11 of 28High
Old keys from chat history, commits and screenshots are rotated
- Check
- Search git history (
git log -p | grep -i key) and your builder's chat log for pasted keys. - Fix
- Rotate anything that was ever pasted or committed.
Payments (Stripe)
Payment bugs either give your product away or charge people twice. Both are quiet until someone notices.
- Check 12 of 28Critical
The webhook verifies the Stripe-Signature header
- Check
curl -X POST <your webhook URL> -d '{"type":"checkout.session.completed"}'must be rejected with 400.- Fix
- Read the raw body (
req.text()), callconstructEventAsyncwith yourwhsec_secret, then parse.
- Check 13 of 28High
The same event processed twice changes nothing
- Check
- Resend an event from the Stripe dashboard. Count payment rows and emails afterwards.
- Fix
- Store
event.idin a table with a unique key before doing any work; skip duplicates.
- Check 14 of 28Critical
Prices and amounts come from your database, not from the browser
- Check
- Replay the create-checkout request with
"amount": 1or"quantity": -1. - Fix
- Build line items server-side from your products or invoice rows. Ignore client-sent prices.
- Check 15 of 28Critical
The success page does not mark anything as paid
- Check
- Open your success URL without paying. The order must stay unpaid.
- Fix
- Only the verified webhook fulfils orders. The success page just shows status.
- Check 16 of 28High
Fulfilment checks amount, currency and the object it pays for
- Check
- Read the webhook handler: does it compare
amount_totaland currency with your record? - Fix
- Compare before marking paid. Log and alert on mismatches.
- Check 17 of 28Medium
Out-of-order and unknown events are handled
- Check
- Does a late
subscription.updatedaftersubscription.deletedbring a plan back? - Fix
- Re-fetch the object from Stripe or compare event timestamps before writing.
Sign-in and authorisation
Hiding a button is not a permission. Every rule has to hold when someone skips your UI.
- Check 18 of 28Critical
Every privileged action is checked on the server or in the database
- Check
- As your lowest role, call admin actions directly (browser console or curl) instead of through the UI.
- Fix
- Check role and ownership in the policy or the server route, not in React.
- Check 19 of 28High
Edge Functions check who is calling
- Check
- Call each
/functions/v1/<name>with no Authorization header. - Fix
- Keep
verify_jwton (except the Stripe webhook) and load the user inside the handler.
- Check 20 of 28High
Login, signup, password reset, email and AI endpoints are rate limited
- Check
- Send 30 requests in a minute. You should see 429s.
- Fix
- Tune Supabase Auth rate limits, add CAPTCHA to signup, and limit your own functions per user and IP.
- Check 21 of 28Medium
Self-signup is off if the app is invite-only
- Check
- Try
POST /auth/v1/signupwith the anon key even if your UI has no signup form. - Fix
- Disable signups in Auth settings and invite users from the server.
When real users arrive
The app that worked for ten testers slows down or goes blank for a thousand customers.
- Check 22 of 28High
Every foreign key and policy column is indexed
- Check
- Advisors lint 0001 (unindexed foreign keys).
EXPLAIN ANALYZEyour main list query and look for Seq Scan. - Fix
create index on public.<table> (<fk column>);composite (tenant_id, sort column) for lists.
- Check 23 of 28Medium
Pages load in a few requests, not one per row
- Check
- Open DevTools → Network on your dashboard. Count
/rest/v1calls. - Fix
- Fetch related rows with one embedded select, or an RPC that returns the page in one query.
- Check 24 of 28Medium
Policies call auth.uid() once per query, not once per row
- Check
- Advisors lint 0003 (
auth_rls_initplan). - Fix
- Write
(select auth.uid())instead ofauth.uid()inside policies.
- Check 25 of 28Medium
Errors are caught, shown and logged
- Check
- Turn off your network and click around. A white screen fails this item.
- Fix
- Error boundaries per page, check every
{ error }from Supabase, and send errors to a logger with a request id.
- Check 26 of 28Medium
Money is stored in integer cents
- Check
- Look for float or
double precisioncolumns named amount, price or total. - Fix
- Use integer minor units (or numeric) and format only for display.
Shipping changes safely
Production needs a way to change the database without guessing, and a place to try it first.
- Check 27 of 28High
Schema changes live in migration files in the repo
- Check
- Is there a
supabase/migrationsfolder that matches production? (supabase db diffshould be empty.) - Fix
supabase db pullonce, then make every change as a migration and apply it withsupabase db push.
- Check 28 of 28Medium
There is a separate staging project with its own keys
- Check
- Do your preview deploys write to the production database?
- Fix
- Create a second Supabase project and separate Stripe test keys for staging.
Or let a script try it: one file, free.
The two-user leak test signs in as two of your test accounts, and as a stranger with only your public key, and reports which tables and database functions leak across them. Read-only, it never prints your data, and it only runs against a project you confirm you own.
It refuses service_role keys, caps itself at 200 requests, and exits with code 1 on any critical or high finding, so it can run in CI against staging. It covers tables and database functions; Storage, Edge Functions and webhooks still need a human review.
Download and run it
Create two test users in separate workspaces, give each a record or two, then run:
SHA-256 (check it with shasum -a 256 leak-test.mjs)e37d63692a0ed0071a2bc2861c80d8f4ff2c6986080e499685aa75cb3b158828
node leak-test.mjs --i-own-this-project \
--url https://<ref>.supabase.co \
--anon-key <publishable key> \
--user-a a@you.dev:pass \
--user-b b@you.dev:passHow to set up the two test users (README)Sample report: before appSample report: hardened app
Found more than you want to fix alone?
The Rescue Audit runs all 28 checks against your app, plus the attacks a scanner can't, in 72 hours for $99. I reply within one business day with a start date and a payment link: rescue@jagritvats.com.