Skip to content
Every tutorial here is 100% free — and always will be
LSLovableStudent

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

  1. Create two real test accounts.
  2. Log in as user A, note an internal ID (e.g. an order ID) from the browser's network tab.
  3. Log in as user B and try to fetch that same ID directly (e.g. by editing a URL or replaying a request).
  4. 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

Website made, maintained and hosted by PromptSites.com

PromptSites logo