A rule in Supabase that controls which rows a user can read, create, update, or delete in a database table.
An RLS Policy (Row-Level Security Policy) is a rule you set on a database table in Supabase that controls who can access which rows of data. It's the security guard for your data.
Each policy targets one operation: SELECT (read), INSERT (create), UPDATE (edit), or DELETE (remove). You can have multiple policies per table. A row must match at least one policy for the operation to succeed.
Common policy patterns:
USING (true) → Anyone can perform this operation (public access)USING (auth.uid() = user_id) → Only the row's owner can access itUSING (auth.role() = 'authenticated') → Any logged-in user can access itWITH CHECK (auth.uid() = user_id) → For INSERT/UPDATE, ensures the user_id matches the authenticated userWhy RLS policies matter for debugging:
The trickiest thing about RLS is that it fails silently. When a policy blocks a query, Supabase doesn't throw an error — it returns an empty array []. Your code runs perfectly, the response comes back with status 200, but the data is empty. This is the most common bug in Chapter 4.
To debug RLS issues:
200 with empty data, it's likely RLSRelated: Row Level Security, Table (Database), Supabase, Authentication, Status Code, Network Tab, Logging
RLS policies are the mechanism through which Authorization is enforced at the database level in Supabase.
We give you the skills to build, deploy, and own a full product. Professional stack, AI co-pilot, no coding background required.