supabase · Supabase Docs
Supabase Row Level Security
Teaches how to implement granular data access control in Supabase by enabling Row Level Security on tables and defining SQL policies for different user roles and operations.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Supabase Row Level Security
Teaches how to implement granular data access control in Supabase by enabling Row Level Security on tables and defining SQL policies for different user roles and operations.
When To Use
Use when you need to restrict database access so that users can only view or modify their own data or specific subsets of rows based on their authentication status.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/supabase-row-level-security-workflow-guide.md | A guide explaining how to implement and manage Postgres Row Level Security policies within Supabase to secure data access. | Questions about a guide explaining how to implement and manage Postgres Row Level Security policies within Supabase to secure data ac... |
examples/supabase-row-level-security-postgres-sql-setup.sql | SQL commands to enable row level security and grant select, insert, update, and delete permissions to anon, authenticated, and service roles. | Exact payloads, commands, or snippets shown in SQL commands to enable row level security and grant select, insert, update, and delete permissions to anon, authentic... |
examples/supabase-row-level-security-sql-policy.sql | A SQL script demonstrating how to create a row level security policy that allows users to view only their own todo items based on their authentication ID. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy that allows users to view only their own todo it... |
examples/supabase-row-level-security-sql-policy-2.sql | A SQL code snippet demonstrating how to implement row level security policies using the auth.uid() function in Supabase. | Exact payloads, commands, or snippets shown in A SQL code snippet demonstrating how to implement row level security policies using the auth.uid() function in Supabase. |
examples/supabase-row-level-security-enable-policy.sql | SQL commands to enable row level security on a table and define access policies. | Exact payloads, commands, or snippets shown in SQL commands to enable row level security on a table and define access policies. |
examples/supabase-row-level-security-auto-enable-function.sql | A SQL script defining a function to automatically enable row level security on newly created tables using an event trigger. | Exact payloads, commands, or snippets shown in A SQL script defining a function to automatically enable row level security on newly created tables using an event tr... |
examples/supabase-row-level-security-postgres-auth-uid-policy.sql | A SQL example demonstrating how to implement Row Level Security policies using the auth.uid() function to restrict data access to the authenticated user. | Exact payloads, commands, or snippets shown in A SQL example demonstrating how to implement Row Level Security policies using the auth.uid() function to restrict da... |
examples/supabase-row-level-security-user-id-policy.sql | A SQL snippet demonstrating a Row Level Security policy that restricts data access based on a matching user_id column. | Exact payloads, commands, or snippets shown in A SQL snippet demonstrating a Row Level Security policy that restricts data access based on a matching userid column. |
examples/supabase-row-level-security-sql-policy-examples.sql | SQL statements demonstrating how to implement row level security policies using auth.uid() in Supabase. | Exact payloads, commands, or snippets shown in SQL statements demonstrating how to implement row level security policies using auth.uid() in Supabase. |
examples/supabase-row-level-security-sql-policy-examples-2.sql | SQL statements demonstrating various PostgreSQL row level security policy configurations for the profiles table. | Exact payloads, commands, or snippets shown in SQL statements demonstrating various PostgreSQL row level security policy configurations for the profiles table. |
examples/supabase-row-level-security-postgres-policy-setup.sql | A SQL script demonstrating how to create a table, enable row level security, and define access policies for a profiles table. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a table, enable row level security, and define access policies for a profile... |
examples/supabase-row-level-security-postgres-policy.sql | A SQL script demonstrating how to create a row level security policy that restricts profile access to the authenticated user's own ID. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy that restricts profile access to the authenticat... |
examples/supabase-row-level-security-profiles-table-policy-setup.sql | A SQL script demonstrating how to create a profiles table, enable row-level security, and define an insert policy for authenticated users. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a profiles table, enable row-level security, and define an insert policy for... |
examples/supabase-row-level-security-profiles-table-policy.sql | SQL commands to create a profiles table, enable row-level security, and define a policy allowing authenticated users to update their own profiles. | Exact payloads, commands, or snippets shown in SQL commands to create a profiles table, enable row-level security, and define a policy allowing authenticated users... |
examples/supabase-row-level-security-postgres-policy-examples.sql | SQL statements demonstrating how to create a table, enable row level security, and define access policies for a profiles table. | Exact payloads, commands, or snippets shown in SQL statements demonstrating how to create a table, enable row level security, and define access policies for a profi... |
examples/supabase-row-level-security-postgres-securityinvoker-view.sql | A SQL example demonstrating how to create a view using the securityinvoker option to respect Row Level Security policies. | Exact payloads, commands, or snippets shown in A SQL example demonstrating how to create a view using the securityinvoker option to respect Row Level Security polic... |
examples/supabase-row-level-security-sql-policy-3.sql | A SQL code snippet demonstrating how to create a row level security policy that validates user team membership using JWT metadata. | Exact payloads, commands, or snippets shown in A SQL code snippet demonstrating how to create a row level security policy that validates user team membership using... |
examples/supabase-row-level-security-postgres-policy-examples-2.sql | SQL statements demonstrating various PostgreSQL row level security policies for restricting database access based on authentication levels. | Exact payloads, commands, or snippets shown in SQL statements demonstrating various PostgreSQL row level security policies for restricting database access based on... |
examples/supabase-row-level-security-bypassrls.sql | A SQL command demonstrating how to alter a role to bypass row level security policies. | Exact payloads, commands, or snippets shown in A SQL command demonstrating how to alter a role to bypass row level security policies. |
examples/supabase-row-level-security-postgres-policy-creation.sql | A SQL script demonstrating how to create a row level security policy on a table using the auth.uid() function. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy on a table using the auth.uid() function. |
examples/supabase-row-level-security-postgres.sql | A SQL script demonstrating the implementation of Row Level Security policies on a PostgreSQL table within Supabase. | Exact payloads, commands, or snippets shown in A SQL script demonstrating the implementation of Row Level Security policies on a PostgreSQL table within Supabase. |
examples/supabase-row-level-security-postgres-policy-creation-2.sql | A SQL script demonstrating how to create a row level security policy on a table using the auth.uid() function. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy on a table using the auth.uid() function. |
examples/supabase-row-level-security-js-select-query.js | A JavaScript code snippet demonstrating a basic select query using the Supabase client to interact with a table subject to row level security. | Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating a basic select query using the Supabase client to interact with a table subje... |
examples/supabase-row-level-security-js-select-query-2.js | A JavaScript code snippet demonstrating a Supabase client select query filtered by a user ID to interact with Row Level Security policies. | Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating a Supabase client select query filtered by a user ID to interact with Row Lev... |
examples/supabase-row-level-security-sql-policy-creation.sql | A SQL script demonstrating how to create a row level security policy using an authenticated user check and a subquery. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy using an authenticated user check and a subquery. |
examples/supabase-row-level-security-custom-function-policy.sql | A SQL script demonstrating how to create a custom security definer function and apply it to a Row Level Security policy. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a custom security definer function and apply it to a Row Level Security policy. |
examples/supabase-row-level-security-sql-policy-creation-2.sql | A SQL script demonstrating how to create a row level security policy that uses a subquery to validate user permissions via a join. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy that uses a subquery to validate user permission... |
examples/supabase-row-level-security-sql-policy-creation-3.sql | A SQL script demonstrating how to create a row level security policy using a subquery to validate team membership via auth.uid(). | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy using a subquery to validate team membership via... |
examples/supabase-row-level-security-postgres-policy-creation-3.sql | A SQL script demonstrating how to create a row level security policy using the auth.uid() function on a test table. | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy using the auth.uid() function on a test table. |
examples/supabase-row-level-security-postgres-policy-creation-4.sql | A SQL script demonstrating how to create a row level security policy for an authenticated user using auth.uid(). | Exact payloads, commands, or snippets shown in A SQL script demonstrating how to create a row level security policy for an authenticated user using auth.uid(). |
What This Skill Covers
- Secure your data using Postgres Row Level Security.
- Main sections:
Row Level Security in Supabase,Policies,Enabling Row Level Security,Auto-enable RLS for new tables,Authenticated and unauthenticated roles.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://supabase.com/docs/guides/database/postgres/row-level-security