Lovable admin page accessible without login: hiding it isn't locking it
- Removing a link from the menu doesn't protect a page. Anyone can type /admin, /crm or /dashboard.
- A redirect to the login screen helps, but the data behind the page has to be protected too, or it can be read directly.
- Test it signed out, in a private window, and look at what the data requests return.
What happened in our own app
We built an app with AI. The users' records were locked down. The internal lead CRM wasn't in the menu, so we assumed it was private. Signed out, we typed /crm: the page loaded, and so did the API behind it. Names, emails and phone numbers of every lead.
Nobody asked the AI to protect the CRM, so it didn't. AI builders protect what you ask for, not what you forget to ask for.
Two layers, and you need both
- The page: if someone without a session (or without the admin role) opens it, they should be sent to the login screen. In apps built with React this check runs in the browser, so on its own it's a curtain, not a lock.
- The data: the database query or API route the page uses must refuse requests without a valid session and the right role. This is the real lock. In Supabase it's a Row Level Security policy; in an API route it's a session check on the server.
Many apps have the first layer and not the second. The page redirects, but the request it makes still answers anyone who sends it.
How to check it yourself
- Write down every private address in your app: /admin, /dashboard, /crm, /settings, /reports, /users, and any page only some users should see.
- Open a private window (signed out) and type each one. You should land on the login screen, with no flash of real data.
- Sign in as a normal user (not admin) and try the admin addresses again.
- With the developer tools open (Network tab), load the admin page as admin and note the requests it makes (to /api/... or to supabase.co). Then repeat those requests signed out. They should return 401/403 or nothing, never the list.
Prompt to fix it
Fix prompt
Protect every private area of the app on the server, not only in the UI. For each admin or internal page (/admin, /crm, /dashboard, /reports and any page only some users should see): redirect to the login page when there's no session or the user doesn't have the required role. Then protect the data it uses: every API route behind these pages must check the session and role on the server and return 401 or 403 otherwise, and every database table they read must have Row Level Security policies that only allow admins (for example a check against an is_admin column on the user's profile). Don't rely on hiding links. List every page, route and policy you changed.
Then repeat the signed-out test, including the data requests.
Want us to run this test for you?
The US$9 crash test without code signs in as two test users on your live app and checks this for you: data between users, private pages and the API behind them, free vs. paid plans, and what your public Supabase key opens. You get the evidence and a fix prompt for each issue.
Related guides
- Can users see each other's data in my Supabase app?
- Can free users get your paid features? How to check your paywall
- Is the Supabase anon key safe to expose in my app?
Updated 2026-11-24