© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
3 replies
cotaetus

enforcing security through RLS vs RPC

RLSSolved
Hi! During development, I realized that some of my users workloads (for example doing an insert on a table) require other inserts to be done in a transactional manner.
RPC functions are the solution to this.

However, I'm not sure how I should deal with security.

If I only want to use RPC for inserts, updates, deletes, i could remove all security policies to related tables and make the functions security definers, so the user can only access the database through that
Selects would still be affected by RLS policies, since I'm not making transactional changes to any tables

OR

I single out tables that are affected by transactional changes, and make the related functions "Security definers", all other functions would "security invokers".

Maybe the answer on how i should deal with RLS and RPC is different, but those are my thoughts.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RLS + Security definer ?
SupabaseSSupabase / help-and-questions
4mo ago
Supabase security strategy: RLS + RPC functions only — good idea?
SupabaseSSupabase / help-and-questions
4mo ago
RLS and security suggestions
SupabaseSSupabase / help-and-questions
3d ago
what is RLS security ... ?????
SupabaseSSupabase / help-and-questions
4y ago