Native rate limiting for client-side SELECT requests to prevent egress abuse #44131
Replies: 3 comments 4 replies
-
|
Hi @ericzager0 1. You can write a SQL function that runs before every Supabase Data API request. Inside it you can check how many requests the current user (from their JWT) has made in the last minute, and raise an error if they exceed a limit. You log each request in a table. |
Beta Was this translation helpful? Give feedback.
-
|
I haven't come across any official Supabase documentation addressing per-user rate limiting. That said, Supabase works well for production workloads overall. |
Beta Was this translation helpful? Give feedback.
-
|
Do not remove RLS policies keep them as your last line of defense. Instead, in Supabase Dashboard → Settings → API, restrict the Data API to only accept the service role key. This blocks direct browser access via the anon key while your Edge Functions still work since they use the service role key server-side. Think of it in layers:
Removing RLS would leave your data completely exposed if the service role key was ever compromised. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Next.js SaaS on Vercel that communicates directly from the browser with Supabase, secured with RLS. My concern is that a malicious authenticated user could script millions of SELECT calls from the browser console and generate huge egress costs. Is there any native Supabase mechanism to prevent this without routing requests through a server-side proxy?
Beta Was this translation helpful? Give feedback.
All reactions