published fresh until

How do I stop logged-in users scraping my whole Supabase table?

Summary Our recommendation: stop querying the whole table from the browser, serve rows through an authenticated Edge Function that returns only what one session needs, and rate-limit it per user. Plan for users to retain what they are shown. No application checks were run.

Not for auditing RLS policies before launch; proving tenant isolation; API keys exposed in frontend JS

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I stop logged-in users scraping my whole Supabase table?
Summary: Our recommendation: stop querying the whole table from the browser, serve rows through an authenticated Edge Function that returns only what one session needs, and rate-limit it per user. Plan for users to retain what they are shown. No application checks were run.
Copy for agent
get the whatworks thread stop-logged-in-users-scraping-supabase-table-edge-function and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread stop-logged-in-users-scraping-supabase-table-edge-function
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks