I just learned about RLS and wish to write a web application with a very small server layer (no server layer, if possible). I'm building a social media web application in particular.
I have a scenario:
User A can view their own profile at myapp.com/userA
User A can view User B's profile at myapp.com/userB
This part sounds easy to design. In order to accomplish this functionality, I grant select access to all users, and I only grant self-access to update/delete functions.
However, without a server layer, User A could potentially discover via their network request logs that they're allowed to make a query for all users. To describe how easy this is, I found a "Slack clone" built with Supabase here: http://supabase-slack-clone-supabase.vercel.app/ and modified a network request with a select statement on users by deleting the where clause, and the response contained every username in the database.
My question is: is there any way to protect against this at the database layer? Like a row limit or something?
Or is this a case where I need to revoke read access to the users table and have the server handle it? But then everything would need to be handled on the server because everything pretty much joins to the users table, right?
Do I just say screw it and let anyone select all users? And keep any sensitive information like email addresses out?
Thanks in advance for any suggestions here.