Can users access other users' information?
Last checked 31 Aug 2026
Short answer
Only if your row-level security policies are missing or too permissive — with correct RLS, a query for 'my orders' can only ever return rows owned by the logged-in user, regardless of what the front end sends.
Why this is a database problem, not a UI problem
Hiding another user's data in the interface (e.g. only showing "your" orders in a list) does nothing if the underlying query could still return anyone's rows when called directly. The fix has to sit in row-level security policies at the database level, not in what the app chooses to display.
The pattern that works
A correct RLS policy on a table like orders restricts every read and write to rows where user_id = auth.uid(), regardless of what the client requests. That way, even if someone inspects network requests and tries to change an ID in the request, the database itself refuses to return another user's row.
How to test it yourself
- Create two real test accounts.
- Log in as user A, note an internal ID (e.g. an order ID) from the browser's network tab.
- Log in as user B and try to fetch that same ID directly (e.g. by editing a URL or replaying a request).
- If user B can see or edit user A's data, the RLS policy is missing or wrong.
A prompt that helps
Review the RLS policy on the orders table and confirm it restricts all reads and writes to rows owned by the authenticated user, not just to what the app's queries currently ask for.
What usually goes wrong
Developers filter by user ID in the front-end query (select().eq('user_id', currentUser.id)) and assume that's enough — but that filter is just a convenience, not security, since a modified request could omit it. The RLS policy, not the client-side filter, is what actually enforces the restriction. See /questions/how-do-i-check-supabase-rls to verify yours, and /questions/how-do-i-protect-admin-pages for the equivalent problem with role-gated pages.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I check Supabase RLS?Ask Lovable to list every table and its row-level security status and policies in plain language — Lovable Cloud users don't have Supabase dashboard access, so this has to go through chat.
- AnswerHow do I prevent spam registrations?Verify email addresses on sign-up, add a CAPTCHA to the registration form, rate-limit sign-up attempts per IP, and check the token server-side before creating an account.
- AnswerHow do I stop bots?Add a CAPTCHA (e.g. Cloudflare Turnstile) to public forms, validate inputs server-side, and rate-limit submissions — client-side-only checks like a hidden field are easy for real bots to bypass.
- AnswerWhere should secrets be stored?In your project's server-side secrets store, used only inside Edge Functions — never in front-end code, client-side environment variables, or committed to your Git repository.