What this thread does
The problem
Supabase maps signed-in requests to the authenticated role. Grants decide whether a role can run an operation on a table; RLS policies decide which rows it applies to. A SELECT policy with USING (true) does not restrict the rows that role can read (RLS guide).
What the thread says
Our recommendation, based on the official docs below:
- Move the read behind server code. Call the database from an Edge Function instead of giving direct table access, and rate-limit that function. Revoke direct SELECT for client roles and keep RLS on. Give the server's database role only the access it needs; check the caller's identity and entitlement inside the function before returning rows.
- Return only what one session needs. Serve the questions of a quiz, or chunks of 30 as the user scrolls, not the table. The chunk size is our starting suggestion, not a Supabase limit.
- Gate by an access table. Have server code write
questions_access (user_id, question_group)rows when you grant access, and return only questions in groups assigned to the caller. - Set expectations. Plan for users to retain the content they are shown. Treat rate limits and smaller responses as friction against bulk collection, not a guarantee against scraping; choose limits that tolerate normal reloads.
Supabase documents Edge Function authentication and an Edge Function rate-limiting example that can use the user ID from Supabase Auth. The authentication guide warns that its admin client bypasses RLS: our recommendation is to check the caller's access explicitly when using privileged server access after revoking client-role grants.
Supabase's client docs add a related default: projects return at most 1,000 rows per request unless you change it in the API settings, and they recommend keeping it low and paginating with range().
What to tell your agent
Our recommendation:
The browser must not select from public.questions. Revoke direct select for anon and authenticated (keep RLS on). Create an Edge Function get-quiz that checks the user's session and quiz entitlement, returns at most 30 questions for the requested quiz, and rejects more than 60 requests per user per hour. Treat these numbers as starting limits to tune. Use a server-only database role with the required access and enforce caller authorization before querying. Update the client to call it. List any other table the client still reads directly.
Common mistakes
Our recommendation:
- Do not rely on browser-side decryption to prevent collection of displayed content.
- Do not rate-limit by IP only; include the authenticated user ID.
- Check for old direct queries in forgotten components.
Caveats
Documentation-based advice; no application checks were run. Our recommendation: for whether your RLS policies leak to anonymous users at all, see the RLS audit thread.
Sources
Primary pages checked 2026-11-30: Supabase's row-level security guide, Edge Function authentication, rate-limiting example, JavaScript v1 client reference, and the PostgreSQL policy reference. We ran no command or code. The v1 reference documents the 1,000-row default, adjustable in API settings, and pagination with range(). The proposed access-table design and numeric request limits are our recommendations, not a reported outcome.
Started from a post by @Petit_Francais, packaged by the editor. Original post