Evidence · 32 files · recorded 22 Nov 2026
Every request behind the case study, as recorded.
The findings on the case study are trimmed from these files. Here they are in full: the scripted attacks on the before app, the same attacks on the hardened one, the advisor reports and the leak test output. Keys and tokens are shortened to their first characters; nothing else is edited.
Attacks on the before app
Each exploit as a scripted request against the local, intentionally vulnerable app, with the full response.
- Anyone with the public anon key reads every agency's invoices and client emailsevidence/
before/ Every agency's revenue, invoice amounts and client contact list is public to anyone who opens DevTools on the login page.fm01-anon-reads-everything.md · F-01 - A stranger who signs up reads every organization, membership and profile (with phone numbers)evidence/
before/ Anyone can sign up and download the full staff and client directory of every agency on the platform, phone numbers included.fm02-stranger-reads-tenants.md · F-06 - A client contact marks her invoice paid, rewrites another client's amount and makes herself ownerevidence/
before/ Any client with a portal login can clear their own bills, change what other clients owe, and take over the agency account.fm03-client-edits-invoices.md · F-03 - The service_role key is in the production JS bundle; with it, RLS no longer existsevidence/
before/ Anyone who views the page source gets a master key to the whole database: read, change or delete every row of every agency.fm04-service-key-in-bundle.md · F-02 - Pay $1 for a $3,621.18 invoice by changing the amount, then mark it paid from the success URLevidence/
before/ Any client can settle any invoice for $1, or for nothing, and the agency's books show it as paid in full.fm06-pay-one-dollar.md · F-05 - A forged, unsigned Stripe webhook marks an unpaid invoice paidevidence/
before/ Anyone on the internet can mark any invoice paid, for any agency, with one unauthenticated POST.fm07-forged-webhook.md · F-04 - Replaying one webhook event creates duplicate payments and duplicate receiptsevidence/
before/ Every retried or replayed Stripe event double-counts revenue and re-emails the client.fm09-webhook-replay.md · F-07 - Anon reads another agency's monthly revenue through get_org_revenue, and every login email through team_directoryevidence/
before/ A competitor can read any agency's monthly revenue, and anyone can harvest the email of every account on the platform.fm11-definer-rpc-and-auth-users.md · F-09, F-10 - A client contact sets user_metadata.role = "admin" and reads the other agency's projects and messagesevidence/
before/ Any signed-in user can promote themselves to "admin" and read or change every agency's projects and client conversations.fm12-user-metadata-escalation.md · F-08 - 50 rapid anonymous calls to send-invoice-email all succeed: no auth, no 429evidence/
before/ Anyone can make the platform send unlimited emails, with real invoice details, to any address, on the agency's bill and sender reputation.fm13-email-function-abuse.md · F-11 - N+1 queries: dashboard and invoice listevidence/
before/ opening the dashboard as Maya (Northlake Studio, about 33 invoices) fires 77 API requests and takes 278 ms on localhost with zero network latency. The request count grows by…n-plus-one.md - Query plans on bulk data (before schema)evidence/
before/ with 72,390 invoices on the platform, every query a single agency makes scans the whole table. Each Seq Scan reads every agency's rows and throws away more than 99% of them,…query-plans.md
The same attacks on the hardened app
The replay against the hardened schema and Worker, plus query plans and the rate-limit check.
- Direct-to-database requests against the hardened schemaevidence/
after/ Measured: 2026-11-22T15:36:22.332Z · localbase (PGlite, Postgres 18) with after/supabase/migrations and demoSeed(), called with the public anon key and signed-in users' tokens,…db-replay.md - F-01: Anonymous access to invoices (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.720Zf-01.md · F-01 - F-03: Client contact edits invoices (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.721Zf-03.md · F-03 - F-04: Forged Stripe webhook (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.722Zf-04.md · F-04 - F-05: Pay $1 for an invoice (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.721Zf-05.md · F-05 - F-06: Another tenant reads agency data (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.721Zf-06.md · F-06 - F-07: Replayed Stripe webhook (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.722Zf-07.md · F-07 - F-08: Privilege escalation via user metadata (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.721Zf-08.md · F-08 - F-09: Another agency's revenue (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.721Zf-09.md · F-09 - F-11: Invoice email abuse (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.722Zf-11.md · F-11 - Query plans on bulk data (after schema)evidence/
after/ Measured: 2026-11-22T16:04:46.779Z · same method as evidence/before/query-plans.md.query-plans.md - RL: Login rate limit (after app)evidence/
after/ Target: http://127.0.0.1:4103 (wrangler dev: workerd, Durable Object SQLite sandbox) · Measured: 2026-11-22T16:17:16.722Zrl.md
Database advisor and UI audits
Supabase-style advisor lints on both schemas, and the AI-look tells in each app’s UI source.
- Database advisor report: afterevidence/
audit/ Source: after/supabase/migrations, loaded into localbase (PGlite, Postgres with Supabase roles and grants). Lints modelled on Supabase splinter. Generated by scripts/audit-db.ts.after.md - Database advisor report: beforeevidence/
audit/ Source: before/supabase/schema.sql, loaded into localbase (PGlite, Postgres with Supabase roles and grants). Lints modelled on Supabase splinter. Generated by scripts/audit-db.ts.before.md - AI-look tells: impeccable detect (v4.10.0)evidence/
audit/ Measured 2026-11-22T17:48Z. Same command on each app's UI source; telemetry off.tells.md
Leak test reports
Output of the free two-user leak test. Reports list tables and counts, never row values.
- Leak test report: the hardened appevidence/
leak-test/ Findings: 0 critical, 0 high, 0 medium, 0 low, 0 infoafter-report.md - Leak test report: the before app, demo seedevidence/
leak-test/ Findings: 18 critical, 2 high, 0 medium, 0 low, 0 infobefore-app-report.md - Leak test report: the before schema, first runevidence/
leak-test/ Findings: 14 critical, 2 high, 0 medium, 0 low, 0 infobefore-report.md
Sources
The prompt log that produced the before app, and the leak test’s README.
- Two-user RLS leak testtools/
leak-test/ Signs in to your Supabase project as two test users and as an anonymous visitor, then reports which tables and database functions show one user's data to a stranger or to the…README.md - Lovable prompt log: Folioport (before)before/
LOVABLE_PROMPTS.md Build me a web app called Folioport. Its a client portal + invoicing tool for small creative agencies (design studios, social media agencies). Agencies can add their clients,…