All findings
highLikelySecuritySR-102

Admin page only hidden in the UI

What is wrong

/admin is hidden from the menu, but the route and its data load for any signed-in user.

Impact: Regular users can view all customers and revenue.

Evidence (fixture)

src/routes/admin.tsx:12–30 · commit a3f9c21

if (!user) redirect('/login')  // no role check (fixture)
Expected
Non-admins receive 403 from the server.
Observed
Any authenticated session loads the admin dataset.

Recommended fix

Check the admin role server-side before returning data.

Repair prompt for your AI builder

src/routes/admin.tsx only checks that a user is logged in. Add a server-side admin role check (roles table + security definer function) before loading admin data.

Paste it into Lovable, Claude Code, Cursor or Codex.