Case studies / Data exposure
criticalNext.js · Supabase · Stripe Connect · Vercel

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

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.

The fix

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.

  1. Enable RLS on orders and payouts in the Supabase SQL editor.
  2. Add select, insert and update policies keyed on the seller id.
  3. Return only amount, date and status from the payout endpoint.
  4. 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 result
  • 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.