Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/supabase-row-level-security-workflow-guide.mdA 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.sqlSQL 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.sqlA 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.sqlA 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.sqlSQL 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.sqlA 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.sqlA 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.sqlA 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.sqlSQL 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.sqlSQL 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.sqlA 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.sqlA 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.sqlA 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.sqlSQL 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.sqlSQL 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.sqlA 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.sqlA 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.sqlSQL 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.sqlA 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.sqlA 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.sqlA 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.sqlA 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.jsA 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.jsA 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.sqlA 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.sqlA 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.sqlA 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.sqlA 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.sqlA 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.sqlA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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