A marketplace built in three weeks, and the database rule it was missing
Two founders built a coaching marketplace with Lovable, Next.js and Supabase. A Deep scan before launch reported that order and payout records were not kept separate per account. Policies were in place by the evening and the re-scan was clean.
Composite case study: built from real Scanwright findings, with names, hosts and figures changed.
- Team
- Two founders, no security background
- Built with
- Lovable, then Cursor
- Scan
- Deep, with a test seller account
- Time to fix
- About four hours
- Result
- Clean re-scan, certificate issued
The app
A marketplace where independent coaches list sessions and clients book and pay. Sellers get a dashboard with their orders and payouts. The data lives in Supabase and the frontend talks to it directly with the public anon key, which is the normal Supabase pattern.
The founders ran the free Simple scan on day one and fixed the headers it flagged. Before taking real bookings they bought a Deep scan and added a throwaway seller account in Setup.
What the report said
- Critical: Row Level Security was off on the orders and payouts tables, so the database did not keep one seller's records separate from another's. The tenant-isolation check, which uses two test accounts, confirmed it.
- High: the seller dashboard API returned the full payout record, including bank details, where the page only needed the amount and date.
- Medium: the security headers from the Simple scan were fixed; two cookies still lacked the Secure flag.
Why it had not been caught
The AI tool that generated the data layer wrote correct queries and never turned on Row Level Security, and nothing in the app looked wrong: every page showed the right data to the right person because the frontend asked for the right rows. The gap was only visible from outside, by asking the database for rows the current user should not have.
Enable Row Level Security on every table that holds customer data and add a policy per operation that ties rows to their owner. Trim the payout API to the fields the page uses.
- Enable RLS on orders and payouts in the Supabase SQL editor.
- Add select, insert and update policies keyed on the seller id.
- Return only amount, date and status from the payout endpoint.
- Run the included re-scan to confirm.
alter table public.payouts enable row level security;
create policy "sellers see their own payouts" on public.payouts
for select using ( auth.uid() = seller_id );
- The re-scan, included with the Deep scan, came back without critical or high findings and issued the certificate the founders put on their pricing page.
- They switched Watch on with the 14-day trial, and the deploy hook now re-checks the public surface after every Vercel deploy.