Leak test report: the before app, demo seed

Source file: evidence/leak-test/before-app-report.md

Project: http://127.0.0.1:4102 (the before app, demo seed) · run 2026-11-22T18:03:13.489Z · 10 tables, 1 functions, 34 requests

Findings: 18 critical, 2 high, 0 medium, 0 low, 0 info

1. [CRITICAL] Anyone with the public key can read "clients" without signing in (5+ rows returned).

  • Check: anon-read on clients
  • Columns exposed: id, org_id, name, contact_name, contact_email, notes, created_at
  • Why it matters: The rows include contact_email, notes. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "clients" (alter table public.clients enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

2. [CRITICAL] User A can read 4 row(s) of "clients" that belong to user B.

  • Check: cross-user-read on clients
  • Columns exposed: id, org_id, name, contact_name, contact_email, notes, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "clients" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

3. [CRITICAL] User B can read 5 row(s) of "clients" that belong to user A.

  • Check: cross-user-read on clients
  • Columns exposed: id, org_id, name, contact_name, contact_email, notes, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "clients" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

4. [CRITICAL] Anyone with the public key can read "invoice_items" without signing in (5+ rows returned).

  • Check: anon-read on invoice_items
  • Columns exposed: id, invoice_id, description, quantity, unit_price, position
  • Why it matters: The rows include unit_price. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "invoice_items" (alter table public.invoice_items enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

5. [CRITICAL] Anyone with the public key can read "invoices" without signing in (5+ rows returned).

  • Check: anon-read on invoices
  • Columns exposed: id, org_id, client_id, project_id, number, status, currency, issued_on, due_on, total, paid_at, stripe_session_id, created_at
  • Why it matters: The rows include total, stripe_session_id. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "invoices" (alter table public.invoices enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

6. [CRITICAL] User A can read 32 row(s) of "invoices" that belong to user B.

  • Check: cross-user-read on invoices
  • Columns exposed: id, org_id, client_id, project_id, number, status, currency, issued_on, due_on, total, paid_at, stripe_session_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "invoices" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

7. [CRITICAL] User B can read 35 row(s) of "invoices" that belong to user A.

  • Check: cross-user-read on invoices
  • Columns exposed: id, org_id, client_id, project_id, number, status, currency, issued_on, due_on, total, paid_at, stripe_session_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "invoices" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

8. [CRITICAL] Anyone with the public key can read "organizations" without signing in (2+ rows returned).

  • Check: anon-read on organizations
  • Columns exposed: id, name, slug, owner_id, stripe_customer_id, created_at
  • Why it matters: The rows include stripe_customer_id. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "organizations" (alter table public.organizations enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

9. [CRITICAL] User A can read 1 row(s) of "organizations" that belong to user B.

  • Check: cross-user-read on organizations
  • Columns exposed: id, name, slug, owner_id, stripe_customer_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "organizations" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (owner_id = (select auth.uid())) or a membership check on the tenant column.

10. [CRITICAL] User B can read 1 row(s) of "organizations" that belong to user A.

  • Check: cross-user-read on organizations
  • Columns exposed: id, name, slug, owner_id, stripe_customer_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "organizations" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (owner_id = (select auth.uid())) or a membership check on the tenant column.

11. [CRITICAL] Anyone with the public key can read "payments" without signing in (5+ rows returned).

  • Check: anon-read on payments
  • Columns exposed: id, invoice_id, amount, stripe_session_id, created_at
  • Why it matters: The rows include amount, stripe_session_id. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "payments" (alter table public.payments enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

12. [CRITICAL] Anyone with the public key can read "profiles" without signing in (5+ rows returned).

  • Check: anon-read on profiles
  • Columns exposed: id, full_name, email, phone, created_at
  • Why it matters: The rows include email, phone. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "profiles" (alter table public.profiles enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

13. [CRITICAL] User A can read 1 row(s) of "profiles" that belong to user B.

  • Check: cross-user-read on profiles
  • Columns exposed: id, full_name, email, phone, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "profiles" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (id = (select auth.uid())) or a membership check on the tenant column.

14. [CRITICAL] User B can read 1 row(s) of "profiles" that belong to user A.

  • Check: cross-user-read on profiles
  • Columns exposed: id, full_name, email, phone, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "profiles" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (id = (select auth.uid())) or a membership check on the tenant column.

15. [CRITICAL] User A can read 6 row(s) of "projects" that belong to user B.

  • Check: cross-user-read on projects
  • Columns exposed: id, org_id, client_id, name, status, due_on, budget, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "projects" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

16. [CRITICAL] User B can read 8 row(s) of "projects" that belong to user A.

  • Check: cross-user-read on projects
  • Columns exposed: id, org_id, client_id, name, status, due_on, budget, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "projects" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (org_id = (select auth.uid())) or a membership check on org_id.

17. [CRITICAL] Anyone with the public key can read "team_directory" without signing in (5+ rows returned).

  • Check: anon-read on team_directory
  • Columns exposed: id, email, full_name, created_at, last_sign_in_at
  • Why it matters: The rows include email. The public key ships in your website's JavaScript, so this is readable by anyone.
  • Fix: Enable RLS on "team_directory" (alter table public.team_directory enable row level security) and add policies that name the signed-in owner. If it must be public, expose a view with only the safe columns.

18. [CRITICAL] Anyone can call get_org_revenue() without signing in, and it returned 7 result(s) for user B's data.

  • Check: anon-rpc on rpc/get_org_revenue
  • Why it matters: Functions marked SECURITY DEFINER run as the database owner and skip RLS. If anon can execute them, they are a side door.
  • Fix: revoke execute on function public.get_org_revenue from anon, public; make it SECURITY INVOKER if possible, or check membership inside it, and set search_path = ''.

19. [HIGH] User A can read 3 row(s) of "memberships" that belong to user B.

  • Check: cross-user-read on memberships
  • Columns exposed: id, org_id, user_id, role, client_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "memberships" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (user_id = (select auth.uid())) or a membership check on org_id.

20. [HIGH] User B can read 3 row(s) of "memberships" that belong to user A.

  • Check: cross-user-read on memberships
  • Columns exposed: id, org_id, user_id, role, client_id, created_at
  • Why it matters: One customer can see another customer's records. This is the classic multi-tenant leak, and it is invisible in the UI.
  • Fix: Replace permissive policies on "memberships" (for example using (true), or auth.role() = 'authenticated') with an ownership check such as using (user_id = (select auth.uid())) or a membership check on org_id.

Row values are never printed or stored by this tool.