id
string
title
string
tier
int64
split
string
tags
list
traps
list
extra_tables
list
fixture_notes
list
created
timestamp[s]
canary
string
requirement
string
schema_sql
string
seed_sql
string
tests_yaml
string
n_tests
int64
solution_sql
string
trap_files
list
T003
Organization projects with files in Supabase Storage
3
train
[ "org-hierarchy", "security-definer-helper", "storage-paths", "public-bucket", "claim-trust" ]
[ "recursive-policy", "claim-trust", "storage-path" ]
[ "storage.objects" ]
[ "user in two orgs: dee (…04) member of org 1 and org 2", "admin of a different org: cy (…03) admin of org 2 only", "user in no org: eli (…05)", "project file with no project folder: storage.objects name='readme.txt' (bucket project-files, owner null)", "avatars owned by other users: '<…01>/me.png', '<…03>/m...
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A project-management app. Organizations have members, each with the role `admin` or `member`. Projects belong to one organization. Project files live in the Supabase Storage bucket `project-files` at the path `<project id>/<file name>`. Profile pictures live in the public bucket `avatars` at the path `<user id>/<file n...
create table public.orgs ( id bigint primary key, name text not null ); create table public.org_members ( org_id bigint not null references public.orgs(id), user_id uuid not null references auth.users(id), role text not null check (role in ('admin', 'member')), primary key (org_id, user_id) ); create tabl...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: member_sees_all_org_memberships covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000002"} sql: select user_id, role from org_members order by user_id expect: {rows: [["00000000-0000-0000-0000-000000000001", admin], ["00000000-0000-0000-0000-000000000002", member], ["00000000-00...
38
create schema private; grant usage on schema private to authenticated; create function private.is_org_member(p_org_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.org_members m where m.org_id = p_org_id and m.user_id = auth.uid(...
[ { "name": "claim-trust", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_org_member(p_org_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select 1 from public.org_members m\n ...
T004
Public user profiles
1
train
[ "single-owner", "public-read", "anon-read", "no-delete" ]
[ "ownership-change", "over-broad-for-all" ]
[]
[ "users with no profile yet: cy (…03) and dee (…04) — moving a profile onto cy has no primary-key conflict" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A community site. Each user can have one public profile; a profile's `id` is the id of the user it belongs to. R1. Anyone, including anonymous visitors, can read every profile. R2. Signed-in users can create a profile only for themselves. R3. Users can edit only their own profile, and cannot move it to another user's ...
create table public.profiles ( id uuid primary key references auth.users(id), username text not null unique, bio text, avatar_url text );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'); insert into public.profile...
- name: anon_reads_all_profiles covers: [R1] as: {role: anon} sql: select username from profiles order by username expect: {rows: [[ana], [ben]]} - name: user_without_profile_reads_all_profiles covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000003"} sql: select username, bio f...
16
alter table public.profiles enable row level security; create policy profiles_select on public.profiles for select to anon, authenticated using (true); create policy profiles_insert on public.profiles for insert to authenticated with check (id = auth.uid()); create policy profiles_update on public.profiles ...
[ { "name": "over-broad-for-all", "sql": "alter table public.profiles enable row level security;\n\ncreate policy profiles_all on public.profiles\n for all to anon, authenticated\n using (true)\n with check (id = auth.uid());\n" }, { "name": "ownership-change", "sql": "alter table public.profil...
T005
Expense receipts with bank-imported rows
1
train
[ "single-owner", "nullable-owner", "anon-vs-authenticated" ]
[ "null-owner" ]
[]
[ "imported receipts with NULL uploaded_by: receipts.id=4 and 5", "user with no receipts: cy (…03)", "numeric amounts with trailing zeros (12.50) to exercise value normalisation" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An expense app. Users upload receipts; `uploaded_by` records who uploaded each one. A nightly job imports receipts from the bank feed, and those rows have no uploader (`uploaded_by` is null). R1. Users can read, edit and delete the receipts they uploaded. R2. Users can add receipts only as themselves. R3. Imported rec...
create table public.receipts ( id bigint generated by default as identity primary key, uploaded_by uuid references auth.users(id), merchant text not null, amount numeric(10, 2) not null, created_at timestamptz not null default '2020-01-01' ); create index receipts_uploaded_by_idx on public.receipts (uploaded...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.receipts (id, uploaded_by, merchant, amount) values (1, '00000000-00...
- name: ana_reads_own_receipts covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000001"} sql: select id from receipts order by id expect: {rows: [[1], [2]]} - name: ana_reads_amounts covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000001"} sql: select ...
20
alter table public.receipts enable row level security; create policy receipts_select on public.receipts for select to authenticated using (uploaded_by = auth.uid()); create policy receipts_insert on public.receipts for insert to authenticated with check (uploaded_by = auth.uid()); create policy receipts_upda...
[ { "name": "null-owner", "sql": "alter table public.receipts enable row level security;\n\ncreate policy receipts_owner on public.receipts\n for all to public\n using (uploaded_by is not distinct from auth.uid())\n with check (uploaded_by is not distinct from auth.uid());\n" } ]
T006
Blog posts with publish windows and inherited comment visibility
2
train
[ "publish-window", "parent-child", "anon-read", "ownership" ]
[ "child-leak", "time-window", "ownership-change" ]
[]
[ "draft post (published_at null): posts.id=2", "scheduled post (published_at 2099): posts.id=3", "expired post (unpublish_at 2021): posts.id=4, with a comment by cy (comments.id=4)", "live post with future unpublish_at (2099): posts.id=5", "comment on a draft: comments.id=3" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A blog. A post is live when `published_at` is set and in the past, and `unpublish_at` is either unset or in the future. Comments belong to a post. R1. Anyone, including anonymous visitors, can read live posts. R2. Authors can read all of their own posts, live or not. R3. Signed-in users can write posts only as themsel...
create table public.posts ( id bigint primary key, author_id uuid not null references auth.users(id), title text not null, body text not null default '', published_at timestamptz, unpublish_at timestamptz ); create table public.comments ( id bigint generated by default as identity primary key, post_id ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.posts (id, author_id, title, published_at, unpublish_at) values (1, ...
- name: anon_reads_live_posts covers: [R1] as: {role: anon} sql: select id from posts order by id expect: {rows: [[1], [5]]} - name: reader_reads_live_posts covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000003"} sql: select id from posts order by id expect: {rows: [[1], [5]...
30
alter table public.posts enable row level security; alter table public.comments enable row level security; create policy posts_select on public.posts for select to anon, authenticated using ( (published_at <= now() and (unpublish_at is null or unpublish_at > now())) or author_id = auth.uid() ); create p...
[ { "name": "child-leak", "sql": "alter table public.posts enable row level security;\nalter table public.comments enable row level security;\n\ncreate policy posts_select on public.posts\n for select to anon, authenticated\n using (\n (published_at <= now() and (unpublish_at is null or unpublish_at > no...
T007
Helpdesk tickets with support agents from a profiles table
2
train
[ "admin-via-profiles", "column-restriction", "insert-defaults", "no-delete" ]
[ "privilege-escalation", "claim-trust", "recursive-policy" ]
[]
[ "agent: sam (…03) has profiles.is_agent = true", "requester with two tickets, one closed and assigned: ana (…01), tickets 1 and 2", "requester ben (…02) with a pending ticket assigned to sam: ticket 3" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A helpdesk. Every user has a profile. Support agents are the users whose profile has `is_agent = true`. Customers open tickets; agents work on them. R1. Users can read their own profile, and agents can read every profile. R2. Users can change their own display name. Nobody can change agent status through the app, incl...
create table public.profiles ( id uuid primary key references auth.users(id), display_name text not null, is_agent boolean not null default false ); create table public.tickets ( id bigint generated by default as identity primary key, requester_id uuid not null references auth.users(id), subject text not n...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'sam@example.com'); insert into public.profiles (id, display_name, is_agent) values ('00000000-0000-0000-0...
- name: customer_reads_own_profile_only covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000001"} sql: select id from profiles order by id expect: {rows: [["00000000-0000-0000-0000-000000000001"]]} - name: agent_reads_every_profile covers: [R1] as: {role: authenticated, sub: "0000...
27
create schema private; grant usage on schema private to authenticated; create function private.is_agent() returns boolean language sql stable security definer set search_path = '' as $$ select coalesce( (select p.is_agent from public.profiles p where p.id = auth.uid()), false ) $$; alter table public.pro...
[ { "name": "claim-trust", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_agent() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select coalesce(\n (select p.is_agent from public.profiles p where p.id = a...
T008
Employee directory view that hides salaries
2
train
[ "column-restriction", "view", "hr-role", "privilege-escalation" ]
[ "view-bypass", "privilege-escalation" ]
[]
[ "HR employee: ana (…01), department 'HR'", "signed-in user with no employee record: eli (…05)", "salaries differ per employee so a leak is visible" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An internal company app. Each employee has one row in `employees`, linked to their login by `user_id`. Employees in the department `HR` handle pay. R1. Provide a view `public.employee_directory` with exactly the columns `id`, `full_name` and `department`. Every signed-in user who is an employee can see every employee ...
create table public.employees ( id bigint primary key, user_id uuid not null unique references auth.users(id), full_name text not null, department text not null, salary numeric(12, 2) not null );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: employee_sees_full_directory covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000002"} sql: select id, full_name, department from employee_directory order by id expect: {rows: [[1, Ana Alves, HR], [2, Ben Brooks, Engineering], [3, Cy Chen, Engineering], [4, Dee Diaz, Sales]]} ...
16
create schema private; grant usage on schema private to anon, authenticated; create function private.is_employee() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.employees e where e.user_id = auth.uid()) $$; create function private.is_hr() return...
[ { "name": "privilege-escalation", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.is_employee() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.employees e where e.user...
T010
Expense approvals through an RPC that must check the caller
3
train
[ "rpc", "security-definer", "column-restriction", "department-membership", "service-role" ]
[ "rpc-missing-auth-check", "service-role-broken", "privilege-escalation" ]
[]
[ "manager with own pending expense: mia (…01), expense 2", "expense already approved: expense 4", "manager of a different department: raj (…04), department 2", "signed-in user in no department: eli (…06)" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An expense tool. Users belong to departments; some members are managers (`is_manager`). Employees submit expenses, and managers approve or reject them. Implement the decision as the function `public.decide_expense(p_expense_id bigint, p_approve boolean) returns void`, which sets `status` to `approved` or `rejected` and...
create table public.departments ( id bigint primary key, name text not null ); create table public.department_members ( department_id bigint not null references public.departments(id), user_id uuid not null references auth.users(id), is_manager boolean not null default false, primary key (department_id, us...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'mia@example.com'), ('00000000-0000-0000-0000-000000000002', 'tom@example.com'), ('00000000-0000-0000-0000-000000000003', 'zoe@example.com'), ('00000000-0000-0000-0000-000000000004', 'raj@example.com'), ('00000000-0000-0000-000...
- name: member_reads_own_expenses covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-000000000002"} sql: select id from expenses order by id expect: {rows: [[1], [4]]} - name: manager_reads_department_expenses covers: [R1] as: {role: authenticated, sub: "00000000-0000-0000-0000-0000000000...
28
create schema private; grant usage on schema private to authenticated; create function private.is_department_member(p_department_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.department_members m where m.department_id = p_depa...
[ { "name": "privilege-escalation", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_department_member(p_department_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select 1 from ...
T011
Organization creation and membership roles from the supabase-js client
3
train
[ "org-hierarchy", "client-returning", "bootstrap-membership", "role-management", "security-definer-helper" ]
[ "insert-returning-visibility", "self-join", "last-owner", "recursive-policy" ]
[]
[ "user in no organization: dee (…04) — creates the new org (id 3 after setval)", "creator who is not a member of the org they created: eli (…05) created org 2, which already has an owner", "sole owner: cy (…03) is the only owner of org 2; ana (…01) the only owner of org 1", "admin who is not owner: ben (…02) i...
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A team app built with supabase-js. Users create organizations and manage who belongs to them. To create an organization the app calls `supabase.from('orgs').insert({ name }).select()` (so the new row is read back immediately), then inserts the creator's membership with role `owner`. Other writes also use `.select()` to...
create table public.orgs ( id bigint generated by default as identity primary key, name text not null, created_by uuid not null default auth.uid() references auth.users(id) ); create table public.org_members ( org_id bigint not null references public.orgs(id) on delete cascade, user_id uuid not null referenc...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: client_creates_org_and_reads_it_back covers: [R1, R3] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000004} client: op: insert table: orgs values: {name: Initech} returning: true expect: {affected: 1} - name: cannot_create_org_for_someone_else covers: [R1] as: {role: ...
35
create schema private; grant usage on schema private to authenticated; create function private.org_role(p_org_id bigint) returns text language sql stable security definer set search_path = '' as $$ select m.role from public.org_members m where m.org_id = p_org_id and m.user_id = auth.uid() $$; create function pr...
[ { "name": "insert-returning-visibility", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.org_role(p_org_id bigint) returns text\nlanguage sql stable security definer set search_path = ''\nas $$\n select m.role from public.org_members m\n where m...
T013
Calendar delegation with private events and a busy-time view
3
train
[ "delegation", "expiry", "private-rows", "view", "ownership", "client-returning" ]
[ "private-row-leak", "time-window", "ownership-change", "view-bypass", "transitive-delegation" ]
[]
[ "edit delegation without expiry: ana → ben (…02)", "read-only delegation expiring 2099: ana → cy (…03)", "expired edit delegation: ana → dee (…04), expired 2020-01-01", "private events: ana's event 2, ben's own event 4", "user with no delegations: eli (…05)" ]
2026-10-24T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A calendar app built with supabase-js. Each event sits on its owner's calendar (`owner_id`). Calendar owners can delegate their calendar to assistants through `delegations`; a delegation may allow editing and may expire at `expires_at` (no value means it never expires). Events are created with `.insert({...}).select()`...
create table public.events ( id bigint generated by default as identity primary key, owner_id uuid not null default auth.uid() references auth.users(id), title text not null, starts_at timestamptz not null, ends_at timestamptz not null, is_private boolean not null default false, check (ends_at > starts_at...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: owner_reads_all_own_events covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from events order by id expect: rows: - [1] - [2] - [3] - name: client_owner_creates_private_event covers: [R1] as: {role: authenticated, sub: 00000000-0000-00...
37
create schema private; grant usage on schema private to anon, authenticated; create function private.has_delegation(p_grantor_id uuid, p_edit boolean) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.delegations d where d.grantor_id = p_gra...
[ { "name": "ownership-change", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.has_delegation(p_grantor_id uuid, p_edit boolean) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select ...
T015
Public contact form that only accepts inserts
1
train
[ "anon-insert", "insert-check", "write-only" ]
[ "anon-write-spoof", "anon-vs-authenticated" ]
[]
[ "two existing messages, one already handled by staff user (…01)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A public website's contact form, built with supabase-js. The form submits with `supabase.from('contact_messages').insert({ name, email, body })` and does not read the row back. Staff handle messages in an internal tool that runs on the server with the service role. R1. Anyone, including anonymous visitors and signed-i...
create table public.contact_messages ( id bigint generated by default as identity primary key, name text not null, email text not null, body text not null, status text not null default 'new' check (status in ('new', 'spam', 'handled')), handled_by uuid references auth.users(id), created_at timestamptz not...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'staff@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.contact_messages (id, name, email, body, status, handled_by) values (1, 'Rita', 'rita@example.org', 'Do you ship to Goa?', 'hand...
- name: anon_submits_message covers: [R1] as: {role: anon} client: op: insert table: contact_messages values: {name: Visitor, email: v@example.org, body: Hello} returning: false expect: {affected: 1} - name: signed_in_user_submits_message covers: [R1] as: {role: authenticated, sub: 00000000...
11
alter table public.contact_messages enable row level security; create policy contact_messages_insert on public.contact_messages for insert to anon, authenticated with check (status = 'new' and handled_by is null);
[ { "name": "anon-vs-authenticated", "sql": "alter table public.contact_messages enable row level security;\n\ncreate policy contact_messages_insert on public.contact_messages\n for insert to authenticated\n with check (status = 'new' and handled_by is null);\n" }, { "name": "anon-write-spoof", ...
T016
Shopping cart that only accepts active products
1
train
[ "single-owner", "public-read", "upsert", "reference-check" ]
[ "reference-check", "upsert-needs-update", "soft-delete-leak" ]
[]
[ "inactive product: products.id=3", "ana (…01) already has product 1 in her cart; ben (…02) has product 2" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A shop built with supabase-js. Product listings are public. The cart page adds an item or changes its quantity with `supabase.from('cart_items').upsert({ user_id, product_id, quantity }).select()` and removes an item with `.delete()`. R1. Anyone, including anonymous visitors, can read active products. Inactive product...
create table public.products ( id bigint primary key, name text not null, price numeric(10, 2) not null, is_active boolean not null default true ); create table public.cart_items ( user_id uuid not null default auth.uid() references auth.users(id), product_id bigint not null references public.products(id),...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.products (id, name, price, is_active) values (1, 'Masala chai', 4.50, true), (2, 'Ceramic mug', 12.00, true), (3, 'Old kettle'...
- name: anon_reads_active_products covers: [R1] as: {role: anon} sql: select id from products order by id expect: rows: - [1] - [2] - name: shopper_cannot_see_inactive_product covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from products where ...
16
alter table public.products enable row level security; alter table public.cart_items enable row level security; create policy products_select on public.products for select to anon, authenticated using (is_active); create policy cart_items_select on public.cart_items for select to authenticated using (user_id ...
[ { "name": "reference-check", "sql": "alter table public.products enable row level security;\nalter table public.cart_items enable row level security;\n\ncreate policy products_select on public.products\n for select to anon, authenticated\n using (is_active);\n\ncreate policy cart_items_select on public.ca...
T017
Courses with preview lessons and self-enrollment
2
train
[ "parent-child", "enrollment", "public-read", "client-returning" ]
[ "child-leak", "reference-check", "ownership-change" ]
[]
[ "unpublished course with a preview lesson: course 2 / lesson 3", "enrolled student: sam (…02) in course 1; non-enrolled student: tia (…03)", "non-preview lesson of a published course: lesson 2", "second instructor: ola (…04), course 3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An online-course platform built with supabase-js. Courses belong to an instructor (`instructor_id`) and have lessons; a lesson can be marked as a free preview. Students enroll themselves with `supabase.from('enrollments').insert({ course_id, student_id }).select()`; other writes also read the written row back with `.se...
create table public.courses ( id bigint primary key, instructor_id uuid not null references auth.users(id), title text not null, is_published boolean not null default false ); create table public.lessons ( id bigint primary key, course_id bigint not null references public.courses(id) on delete cascade, t...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ivy@example.com'), ('00000000-0000-0000-0000-000000000002', 'sam@example.com'), ('00000000-0000-0000-0000-000000000003', 'tia@example.com'), ('00000000-0000-0000-0000-000000000004', 'ola@example.com'); insert into public.course...
- name: anon_reads_published_courses covers: [R1] as: {role: anon} sql: select id from courses order by id expect: rows: - [1] - [3] - name: instructor_reads_own_unpublished_course covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from courses or...
26
alter table public.courses enable row level security; alter table public.lessons enable row level security; alter table public.enrollments enable row level security; create policy courses_select on public.courses for select to anon, authenticated using (is_published or instructor_id = auth.uid()); create policy c...
[ { "name": "child-leak", "sql": "alter table public.courses enable row level security;\nalter table public.lessons enable row level security;\nalter table public.enrollments enable row level security;\n\ncreate policy courses_select on public.courses\n for select to anon, authenticated\n using (is_publishe...
T018
Clinic records that require an MFA session for doctors
2
train
[ "mfa", "jwt-claims", "care-team", "append-only", "client-returning" ]
[ "mfa-not-enforced", "claim-trust", "reference-check" ]
[]
[ "doctor dia (…03) is in patient pam's (…01) care team; doctor ed (…04) in pete's (…02)", "patient pete also carries user_metadata role=doctor in one test (claim-trust)", "each doctor test runs once with aal1 and once with aal2" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A telehealth app built with supabase-js. Doctors must use multi-factor authentication: Supabase sets the JWT claim `aal` to `aal2` in a session that passed an MFA challenge and to `aal1` otherwise. Doctors add notes with `supabase.from('records').insert({ patient_id, author_id, note }).select()`. R1. Patients can read...
create table public.patients ( id bigint primary key, user_id uuid not null unique references auth.users(id), full_name text not null ); create table public.care_team ( patient_id bigint not null references public.patients(id), doctor_id uuid not null references auth.users(id), primary key (patient_id, doc...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'pam@example.com'), ('00000000-0000-0000-0000-000000000002', 'pete@example.com'), ('00000000-0000-0000-0000-000000000003', 'dia@example.com'), ('00000000-0000-0000-0000-000000000004', 'ed@example.com'); insert into public.patien...
- name: patient_reads_own_records covers: [R1] as: role: authenticated sub: 00000000-0000-0000-0000-000000000001 claims: {aal: aal1} sql: select id from records order by id expect: rows: - [1] - [2] - name: patient_reads_own_patient_row covers: [R1] as: role: authenticated s...
20
create schema private; grant usage on schema private to authenticated; create function private.is_patient(p_patient_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.patients p where p.id = p_patient_id and p.user_id = auth.uid()) $$; cre...
[ { "name": "claim-trust", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_patient(p_patient_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.patients p where p.id...
T019
Group chat where blocked users cannot post
2
train
[ "membership", "negative-condition", "security-definer-helper", "client-returning" ]
[ "negative-condition", "recursive-policy", "ownership-change" ]
[]
[ "ben (…02) has blocked cy (…03); dee (…04) has blocked cy", "conversation 2 includes ana, ben and cy; conversation 3 cy and dee", "dee, the blocker, can still post in conversation 3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A chat app built with supabase-js. Conversations have participants; users can block other users. Messages are sent with `supabase.from('messages').insert({ conversation_id, sender_id, body }).select()` and edited with `.update({ body }).eq('id', id).select()`. R1. Users can see the conversations they take part in and ...
create table public.conversations ( id bigint primary key, title text not null ); create table public.participants ( conversation_id bigint not null references public.conversations(id), user_id uuid not null references auth.users(id), primary key (conversation_id, user_id) ); create table public.messages ( ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'); insert into public.convers...
- name: user_sees_own_conversations covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from conversations order by id expect: rows: - [1] - [2] - name: user_sees_participants_of_own_conversations covers: [R1] as: {role: authenticated, sub: 00000000-...
25
create schema private; grant usage on schema private to authenticated; create function private.is_participant(p_conversation_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.participants p where p.conversation_id = p_conversation...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_participant(p_conversation_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select 1 from public...
T020
Multi-tenant CRM isolated by server-set JWT claims
3
train
[ "multi-tenant", "jwt-claims", "restrictive-policy", "role-from-claims", "client-returning" ]
[ "restrictive-vs-permissive", "claim-trust", "privilege-escalation" ]
[]
[ "acme admin ana (…01), acme agent ben (…02), globex agent cy (…03)", "user with no tenant claim: dee (…04)", "globex agent eve (…05) whose user_metadata claims acme admin", "archived acme contact: contacts.id=3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A multi-tenant CRM built with supabase-js. The server puts each user's tenant and tenant role into the JWT as `app_metadata.tenant_id` and `app_metadata.tenant_role` (`admin` or `agent`); users cannot edit `app_metadata`, but they can edit `user_metadata`. Writes read the row back with `.select()`. R1. A user's tenant...
create table public.contacts ( id bigint generated by default as identity primary key, tenant_id text not null, owner_id uuid not null default auth.uid() references auth.users(id), name text not null, is_archived boolean not null default false ); create table public.tenant_settings ( tenant_id text primary...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: agent_reads_active_tenant_contacts covers: [R2] as: role: authenticated sub: 00000000-0000-0000-0000-000000000002 claims: app_metadata: {tenant_id: acme, tenant_role: agent} sql: select id from contacts order by id expect: rows: - [1] - [2] - name: admin_reads_archived_con...
27
create schema private; grant usage on schema private to authenticated; create function private.tenant_id() returns text language sql stable as $$ select auth.jwt() -> 'app_metadata' ->> 'tenant_id' $$; create function private.is_tenant_admin() returns boolean language sql stable as $$ select coalesce(auth.jwt() ...
[ { "name": "claim-trust", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.tenant_id() returns text\nlanguage sql stable\nas $$\n select coalesce(auth.jwt() -> 'user_metadata' ->> 'tenant_id', auth.jwt() -> 'app_metadata' ->> 'tenant_id')\n$$;\n\nc...
T021
Storage bucket with per-user public and private folders
3
train
[ "storage-paths", "public-bucket-subset", "anon-read", "client-returning" ]
[ "storage-path", "ownership-change", "bucket-scope" ]
[ "storage.objects" ]
[ "object whose path contains 'public' deeper in a private folder: '<…03>/private/public/x.txt'", "object not under a user folder: media 'shared/readme.txt' (owner null)", "internal bucket object: 'reports/q3.pdf'" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A portfolio site built with supabase-js and Supabase Storage. All files live in the bucket `media`, under the uploader's folder: `<user id>/public/<file>` for files shown on their public page and `<user id>/private/<file>` for everything else (sub-folders are allowed below these). The bucket `internal` is used only by ...
-- This task uses Supabase Storage only: storage.buckets and storage.objects already exist.
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into storage.buckets (id, name, public) values ('media', 'media', false), ('in...
- name: anon_reads_public_files covers: [R1] as: {role: anon} sql: select name from storage.objects where bucket_id = 'media' order by name expect: rows: - [00000000-0000-0000-0000-000000000001/public/cv.pdf] - [00000000-0000-0000-0000-000000000002/public/logo.svg] - name: user_reads_own_files_and_...
19
create policy media_public_read on storage.objects for select to anon, authenticated using (bucket_id = 'media' and (storage.foldername(name))[2] = 'public'); create policy media_own_read on storage.objects for select to authenticated using (bucket_id = 'media' and (storage.foldername(name))[1] = auth.uid()::t...
[ { "name": "bucket-scope", "sql": "create policy media_public_read on storage.objects\n for select to anon, authenticated\n using (bucket_id = 'media' and (storage.foldername(name))[2] = 'public');\n\ncreate policy media_own_read on storage.objects\n for select to authenticated\n using (bucket_id = 'medi...
T022
Points transfer RPC that must validate its own input
3
train
[ "rpc", "security-definer", "input-validation", "read-only-tables" ]
[ "rpc-input-validation", "overdraft" ]
[]
[ "balances: ana 100, ben 20, cy 0; dee (…04) has no wallet", "existing transfer: ana → ben 30", "no check constraints on balance or amount, so the function must validate" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A rewards app built with supabase-js. Users send points to each other by calling the RPC `supabase.rpc('send_points', { p_to, p_amount })`. Implement it as `public.send_points(p_to uuid, p_amount integer) returns bigint`, returning the new transfer's id. R1. Users can read only their own wallet. R2. Users can read the...
create table public.wallets ( user_id uuid primary key references auth.users(id), balance integer not null ); create table public.transfers ( id bigint generated by default as identity primary key, from_user uuid not null references auth.users(id), to_user uuid not null references auth.users(id), amount in...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'); insert into public.wallets...
- name: user_reads_own_wallet covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select user_id, balance from wallets order by user_id expect: rows: - [00000000-0000-0000-0000-000000000001, 100] - name: user_cannot_read_other_wallet covers: [R1] as: {role: authen...
17
alter table public.wallets enable row level security; alter table public.transfers enable row level security; create policy wallets_select on public.wallets for select to authenticated using (user_id = auth.uid()); create policy transfers_select on public.transfers for select to authenticated using (from_user...
[ { "name": "overdraft", "sql": "alter table public.wallets enable row level security;\nalter table public.transfers enable row level security;\n\ncreate policy wallets_select on public.wallets\n for select to authenticated\n using (user_id = auth.uid());\n\ncreate policy transfers_select on public.transfer...
T023
Library loans limited by free copies and per-member caps
2
train
[ "aggregate-limit", "column-restriction", "state-transition", "client-returning" ]
[ "aggregate-limit", "old-vs-new", "state-transition" ]
[]
[ "book 1 has 1 copy and 1 active loan (full); book 4 has 1 copy, only a returned loan", "ben (…02) has 3 active loans (at the cap); ana (…01) has 2", "returned loan: loans.id=6 (cy)", "librarian: lib (…04)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A library app built with supabase-js. A loan is active while `returned_on` is empty. Members borrow with `supabase.from('loans').insert({ book_id, borrower_id }).select()` and return a book with `.update({ returned_on }).eq('id', id).select()`. R1. Signed-in users can see the whole book catalogue. Anonymous visitors c...
create table public.books ( id bigint primary key, title text not null, copies integer not null check (copies >= 0) ); create table public.librarians ( user_id uuid primary key references auth.users(id) ); create table public.loans ( id bigint generated by default as identity primary key, book_id bigint n...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'lib@example.com'); insert into public.librari...
- name: member_sees_catalogue covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from books expect: rows: - [5] - name: anon_cannot_see_catalogue covers: [R1, R7] as: {role: anon} sql: select * from books expect: {denied: true} - name: member...
25
create schema private; grant usage on schema private to authenticated; create function private.is_librarian() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.librarians l where l.user_id = auth.uid()) $$; create function private.free_copies(p_book...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_librarian() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.librarians l where l.user_id = aut...
T024
Push-notification tokens registered by upsert
1
train
[ "single-owner", "upsert", "takeover" ]
[ "upsert-takeover", "upsert-needs-update" ]
[]
[ "ana's (…01) existing token 'tok-ana-phone'; ben's (…02) 'tok-ben-web'", "user with no tokens: cy (…03)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A mobile app built with supabase-js registers its push-notification token on every launch with `supabase.from('push_tokens').upsert({ token, user_id, platform }, { onConflict: 'token' }).select()`. Knowing a token is enough to send notifications to that device. R1. Users can see only their own tokens. R2. Users can re...
create table public.push_tokens ( token text primary key, user_id uuid not null default auth.uid() references auth.users(id), platform text not null check (platform in ('ios', 'android', 'web')), updated_at timestamptz not null default '2020-01-01' );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.push_tokens (token, user_id, platform) values ('tok-ana-phone', '000...
- name: user_sees_own_tokens covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select token from push_tokens order by token expect: rows: - [tok-ana-phone] - name: user_without_tokens_sees_none covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-...
12
alter table public.push_tokens enable row level security; create policy push_tokens_select on public.push_tokens for select to authenticated using (user_id = auth.uid()); create policy push_tokens_insert on public.push_tokens for insert to authenticated with check (user_id = auth.uid()); create policy push_t...
[ { "name": "upsert-needs-update", "sql": "alter table public.push_tokens enable row level security;\n\ncreate policy push_tokens_select on public.push_tokens\n for select to authenticated\n using (user_id = auth.uid());\n\ncreate policy push_tokens_insert on public.push_tokens\n for insert to authenticate...
T025
Newsletter subscriptions managed by verified email
1
train
[ "anon-insert", "jwt-claims", "email-match" ]
[ "anon-write-spoof", "case-sensitivity", "claim-trust" ]
[]
[ "ana's subscriptions stored as 'Ana@Example.com' and 'ana@example.com' (mixed case)", "ben's (…02) user_metadata claims ana's email", "confirmed and unconfirmed rows" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A newsletter built with supabase-js. Visitors subscribe with `supabase.from('subscriptions').insert({ email, topic })` and do not read the row back. Confirmation links are handled by server code using the service role. Signed-in users manage the subscriptions of their own address on a settings page; Supabase puts the a...
create table public.subscriptions ( id bigint generated by default as identity primary key, email text not null, topic text not null check (topic in ('weekly', 'product')), confirmed boolean not null default false, created_at timestamptz not null default '2020-01-01', unique (email, topic) );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.subscriptions (id, email, topic, confirmed) values (1, 'Ana@Example.com', 'weekly', true), (2, 'ana@example.com', 'product', fal...
- name: anon_subscribes covers: [R1] as: {role: anon} client: op: insert table: subscriptions values: {email: new@example.org, topic: weekly} returning: false expect: {affected: 1} - name: signed_in_user_subscribes covers: [R1] as: role: authenticated sub: 00000000-0000-0000-0000-00...
12
alter table public.subscriptions enable row level security; create policy subscriptions_insert on public.subscriptions for insert to anon, authenticated with check (not confirmed); create policy subscriptions_select on public.subscriptions for select to authenticated using (lower(email) = lower(auth.jwt() ->>...
[ { "name": "anon-write-spoof", "sql": "alter table public.subscriptions enable row level security;\n\ncreate policy subscriptions_insert on public.subscriptions\n for insert to anon, authenticated\n with check (true);\n\ncreate policy subscriptions_select on public.subscriptions\n for select to authentica...
T027
API keys whose hash column is never readable
1
train
[ "column-restriction", "single-owner", "state-transition" ]
[ "column-leak", "state-transition" ]
[]
[ "ana (…01): active keys 1 and 2, revoked key 3", "ben (…02): active key 4" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A developer dashboard built with supabase-js. API keys are created by a server function using the service role, which stores only a hash of each key. The dashboard lists keys with `supabase.from('api_keys').select('id, name, last4, created_at, revoked_at')` and revokes a key with `supabase.from('api_keys').update({ rev...
create table public.api_keys ( id bigint generated by default as identity primary key, user_id uuid not null default auth.uid() references auth.users(id), name text not null, key_hash text not null, last4 text not null, created_at timestamptz not null default '2020-01-01', revoked_at timestamptz );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.api_keys (id, user_id, name, key_hash, last4, revoked_at) values (1, '00000000-0000-0000-0000-000000000001', 'CI', 'sha256$9f2c', ...
- name: user_lists_own_keys covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} client: {op: select, table: api_keys, columns: 'id, name, last4', order: id} expect: rows: - [1, CI, a1b2] - [2, Laptop, c3d4] - [3, Old server, e5f6] - name: user_cannot_read_own_key_h...
12
alter table public.api_keys enable row level security; revoke select, insert, update, delete on public.api_keys from anon, authenticated; grant select (id, user_id, name, last4, created_at, revoked_at) on public.api_keys to authenticated; grant update (revoked_at) on public.api_keys to authenticated; create policy ap...
[ { "name": "column-leak", "sql": "alter table public.api_keys enable row level security;\n\ncreate policy api_keys_select on public.api_keys\n for select to authenticated\n using (user_id = auth.uid());\n\ncreate policy api_keys_update on public.api_keys\n for update to authenticated\n using (user_id = a...
T029
Event RSVPs with private invites and capacity limits
2
train
[ "aggregate-limit", "private-rows", "invitations", "client-returning" ]
[ "aggregate-limit", "private-row-leak", "reference-check" ]
[]
[ "event 1 public, capacity 2, one RSVP (ana) — one seat left", "event 2 private, invites ana and ben, ana RSVPed", "event 3 public, capacity 1, full (ben)", "host hal (…01); cy (…04) and dee (…05) not invited" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An events app built with supabase-js. Guests RSVP with `supabase.from('rsvps').insert({ event_id, user_id }).select()` and cancel with `.delete()`. Hosts invite people to private events by inserting into `invites`. R1. Signed-in users can see public events. Private events are visible only to their host and to invited ...
create table public.events ( id bigint primary key, host_id uuid not null references auth.users(id), title text not null, is_private boolean not null default false, capacity integer not null check (capacity > 0) ); create table public.invites ( event_id bigint not null references public.events(id) on delet...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'hal@example.com'), ('00000000-0000-0000-0000-000000000002', 'ana@example.com'), ('00000000-0000-0000-0000-000000000003', 'ben@example.com'), ('00000000-0000-0000-0000-000000000004', 'cy@example.com'), ('00000000-0000-0000-0000...
- name: invited_user_sees_private_event covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select id from events order by id expect: rows: - [1] - [2] - [3] - name: uninvited_user_sees_only_public_events covers: [R1] as: {role: authenticated, sub: 0000000...
22
create schema private; grant usage on schema private to authenticated; create function private.is_host(p_event_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.events e where e.id = p_event_id and e.host_id = auth.uid()) $$; create funct...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_host(p_event_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.events e where e.id = ...
T030
Expense splitting with shares limited to group members
2
train
[ "membership", "parent-child", "reference-check", "ownership", "client-returning" ]
[ "reference-check", "ownership-change", "child-leak" ]
[]
[ "group 1: ana, ben; group 2: ben, cy; dee (…04) in no group", "expense 3 paid by ben in group 1 (ben is also in group 2)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An expense-splitting app built with supabase-js. Adding an expense inserts it with `supabase.from('expenses').insert({...}).select()` and then inserts one `expense_shares` row per person; edits use `.update({...}).eq(...).select()`. R1. Members can see their groups and every member of those groups. R2. Members can rea...
create table public.groups ( id bigint primary key, name text not null ); create table public.group_members ( group_id bigint not null references public.groups(id), user_id uuid not null references auth.users(id), primary key (group_id, user_id) ); create table public.expenses ( id bigint generated by def...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'); insert into public.groups ...
- name: member_sees_own_groups covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id from groups order by id expect: rows: - [1] - [2] - name: member_sees_group_members covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} ...
22
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_group_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.group_members m where m.group_id = p_group_id and m.user_id = auth.uid()) $$...
[ { "name": "child-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_group_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.group_members m where m.g...
T031
Leave requests approved only by the direct manager
3
train
[ "hierarchy", "old-vs-new", "trigger", "state-transition", "client-full-row-update" ]
[ "old-vs-new", "state-transition", "skip-level-access" ]
[]
[ "maya (…01) manages raj (…02) and lee (…03) and reports to ceo (…05) — ceo is raj's skip-level manager", "raj: pending request 1, approved request 2; lee: pending 3; maya: pending 4 (her manager is ceo)", "tom (…04) reports to ceo and has no requests" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An HR app built with supabase-js. Each employee has at most one manager (`manager_id`). Employees request leave with `supabase.from('leave_requests').insert({ employee_id, starts_on, ends_on, note }).select()`; the leave form saves with `.update({ starts_on, ends_on, note, status }).eq('id', id).select()`, sending ever...
create table public.employees ( user_id uuid primary key references auth.users(id), full_name text not null, manager_id uuid references public.employees(user_id) ); create table public.leave_requests ( id bigint generated by default as identity primary key, employee_id uuid not null default auth.uid() refere...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'maya@example.com'), ('00000000-0000-0000-0000-000000000002', 'raj@example.com'), ('00000000-0000-0000-0000-000000000003', 'lee@example.com'), ('00000000-0000-0000-0000-000000000004', 'tom@example.com'), ('00000000-0000-0000-00...
- name: employee_reads_own_requests covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id from leave_requests order by id expect: rows: - [1] - [2] - name: manager_reads_direct_reports_and_own covers: [R1] as: {role: authenticated, sub: 00000000-0000-0...
25
create schema private; grant usage on schema private to authenticated; create function private.is_manager_of(p_employee_id uuid) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.employees e where e.user_id = p_employee_id and e.manager_id =...
[ { "name": "old-vs-new", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_manager_of(p_employee_id uuid) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select 1 from public.employees e\n ...
T032
Agency client portal with staff-only internal comments
2
train
[ "staff-role", "private-rows", "client-scoping", "client-returning" ]
[ "private-row-leak", "privilege-escalation", "reference-check" ]
[]
[ "internal comment on cara's project: project_comments.id=2", "staff: sue (…01), sam (…02); clients: cara (…03) project 1, carl (…04) project 2" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An agency's client portal built with supabase-js. Staff are the users listed in `staff`; each project belongs to one client. Comments are posted with `supabase.from('project_comments').insert({ project_id, author_id, body, is_internal }).select()` and edited with `.update({...}).eq('id', id).select()`. Internal comment...
create table public.staff ( user_id uuid primary key references auth.users(id) ); create table public.projects ( id bigint primary key, client_id uuid not null references auth.users(id), name text not null ); create table public.project_comments ( id bigint generated by default as identity primary key, pr...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'sue@example.com'), ('00000000-0000-0000-0000-000000000002', 'sam@example.com'), ('00000000-0000-0000-0000-000000000003', 'cara@example.com'), ('00000000-0000-0000-0000-000000000004', 'carl@example.com'); insert into public.staf...
- name: client_sees_own_project covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select id from projects order by id expect: rows: - [1] - name: staff_sees_every_project covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: se...
20
create schema private; grant usage on schema private to authenticated; create function private.is_staff() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.staff s where s.user_id = auth.uid()) $$; create function private.is_project_client(p_project...
[ { "name": "private-row-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_staff() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.staff s where s.user_id = auth.uid())...
T034
Saved searches whose alerts only go to the user's own email
1
train
[ "single-owner", "jwt-claims", "insert-check", "client-returning" ]
[ "foreign-email", "claim-trust" ]
[]
[ "ana's (…01) JWT email ana@example.com; ben's ben@example.com", "one test gives ana a user_metadata email of victim@example.org" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A property-search site built with supabase-js. Users save searches with `supabase.from('saved_searches').insert({...}).select()` and edit them with `.update({...}).eq('id', id).select()`. When `notify_email` is set, a server job emails new matches to that address. Supabase puts the account's verified email address in t...
create table public.saved_searches ( id bigint generated by default as identity primary key, user_id uuid not null default auth.uid() references auth.users(id), query text not null, notify_email text, frequency text not null default 'off' check (frequency in ('daily', 'weekly', 'off')) );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.saved_searches (id, user_id, query, notify_email, frequency) values (1, '00000000-0000-0000-0000-000000000001', '2BHK in Pune unde...
- name: user_reads_own_searches covers: [R1] as: role: authenticated sub: 00000000-0000-0000-0000-000000000001 claims: {email: ana@example.com} sql: select id from saved_searches order by id expect: rows: - [1] - name: other_user_reads_only_own_searches covers: [R1] as: role: authen...
14
alter table public.saved_searches enable row level security; create policy saved_searches_select on public.saved_searches for select to authenticated using (user_id = auth.uid()); create policy saved_searches_insert on public.saved_searches for insert to authenticated with check ( user_id = auth.uid() ...
[ { "name": "claim-trust", "sql": "alter table public.saved_searches enable row level security;\n\ncreate policy saved_searches_select on public.saved_searches\n for select to authenticated\n using (user_id = auth.uid());\n\ncreate policy saved_searches_insert on public.saved_searches\n for insert to authe...
T035
Public guestbook with ownerless anonymous entries
1
train
[ "anon-insert", "nullable-owner", "moderation" ]
[ "null-owner", "anon-write-spoof" ]
[]
[ "anonymous entries with NULL author_id: id 2 (approved) and id 3 (unapproved)", "ben's (…02) own unapproved entry: id 4" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A personal website's guestbook built with supabase-js. Visitors sign it with `supabase.from('guestbook_entries').insert({ display_name, message })` and do not read the row back. `author_id` defaults to `auth.uid()`, so signed-in visitors' entries record their user id and anonymous entries have no author. The site owner...
create table public.guestbook_entries ( id bigint generated by default as identity primary key, author_id uuid default auth.uid() references auth.users(id), display_name text not null, message text not null, is_approved boolean not null default false, created_at timestamptz not null default '2020-01-01' );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.guestbook_entries (id, author_id, display_name, message, is_approved) values (1, '00000000-0000-0000-0000-000000000001', 'Ana', 'G...
- name: anon_reads_approved_entries covers: [R1] as: {role: anon} sql: select id from guestbook_entries order by id expect: rows: - [1] - [2] - name: author_also_reads_own_unapproved_entry covers: [R1, R3] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id fro...
16
alter table public.guestbook_entries enable row level security; create policy guestbook_select on public.guestbook_entries for select to anon, authenticated using (is_approved or author_id = auth.uid()); create policy guestbook_insert on public.guestbook_entries for insert to anon, authenticated with check (n...
[ { "name": "anon-write-spoof", "sql": "alter table public.guestbook_entries enable row level security;\n\ncreate policy guestbook_select on public.guestbook_entries\n for select to anon, authenticated\n using (is_approved or author_id = auth.uid());\n\ncreate policy guestbook_insert on public.guestbook_ent...
T036
Product reviews by verified buyers with staff-only featuring
1
train
[ "public-read", "reference-check", "upsert", "column-restriction" ]
[ "reference-check", "privilege-escalation" ]
[]
[ "purchases: ana (…01) bought products 1 and 2, ben (…02) bought 1, cy (…03) none", "ben's featured review on product 1" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A shop built with supabase-js. Purchases are recorded by the server. Customers write or update their review with `supabase.from('reviews').upsert({ product_id, user_id, rating, body }).select()`. Staff choose featured reviews in an admin tool that uses the service role. R1. Anyone, including anonymous visitors, can re...
create table public.products ( id bigint primary key, name text not null ); create table public.purchases ( user_id uuid not null references auth.users(id), product_id bigint not null references public.products(id), primary key (user_id, product_id) ); create table public.reviews ( product_id bigint not n...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.products (id, name) values (1, 'Electric kettle'), (2, 'Ceramic mug');...
- name: anon_reads_reviews covers: [R1] as: {role: anon} sql: select product_id, user_id, rating from reviews order by product_id expect: rows: - [1, 00000000-0000-0000-0000-000000000002, 4] - name: anon_reads_products covers: [R1] as: {role: anon} sql: select count(*) from products expect: ...
15
alter table public.products enable row level security; alter table public.purchases enable row level security; alter table public.reviews enable row level security; revoke insert, update on public.reviews from anon, authenticated; grant insert (product_id, user_id, rating, body) on public.reviews to authenticated; gra...
[ { "name": "privilege-escalation", "sql": "alter table public.products enable row level security;\nalter table public.purchases enable row level security;\nalter table public.reviews enable row level security;\n\ncreate policy products_select on public.products\n for select to anon, authenticated\n using (...
T037
Contracts whose versions and tags inherit sharing
2
train
[ "parent-child", "sharing", "multi-table", "append-only", "client-returning" ]
[ "forgot-enable", "child-leak", "reference-check" ]
[]
[ "contract 1 owned by olga (…01) and shared with sid (…02); contract 2 olga's, not shared; contract 3 tara's (…03)", "user with no access: ugo (…04)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A contract-management app built with supabase-js. Each contract has an owner and can be shared with other users. Versions and tags hang off a contract. Writes read the row back with `.select()`. R1. Owners can create contracts as themselves and read, rename and delete their own contracts. Users can read the contracts ...
create table public.contracts ( id bigint primary key, owner_id uuid not null references auth.users(id), title text not null ); create table public.contract_shares ( contract_id bigint not null references public.contracts(id) on delete cascade, user_id uuid not null references auth.users(id), primary key (...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'olga@example.com'), ('00000000-0000-0000-0000-000000000002', 'sid@example.com'), ('00000000-0000-0000-0000-000000000003', 'tara@example.com'), ('00000000-0000-0000-0000-000000000004', 'ugo@example.com'); insert into public.cont...
- name: owner_reads_own_contracts covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from contracts order by id expect: rows: - [1] - [2] - name: shared_user_reads_shared_contract covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-0...
23
create schema private; grant usage on schema private to authenticated; create function private.is_contract_owner(p_contract_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.contracts c where c.id = p_contract_id and c.owner_id = auth.uid(...
[ { "name": "child-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_contract_owner(p_contract_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.contracts c wh...
T038
Marketplace listings with soft delete and moderator flags
2
train
[ "soft-delete", "moderation", "public-read", "client-returning" ]
[ "soft-delete-visibility", "soft-delete-leak", "privilege-escalation" ]
[]
[ "sal's (…01) listings: 1 active, 2 draft, 3 flagged, 4 soft-deleted", "bea's (…02) listings: 5 active, 6 draft", "moderator: mo (…03)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A second-hand marketplace built with supabase-js. Sellers create listings with `.insert({...}).select()` and edit them with `.update({...}).eq('id', id)`. Listings are never hard-deleted: a seller removes one with `.update({ deleted_at }).eq('id', id)`. Moderators (users in `moderators`) flag listings that break the ru...
create table public.moderators ( user_id uuid primary key references auth.users(id) ); create table public.listings ( id bigint generated by default as identity primary key, seller_id uuid not null default auth.uid() references auth.users(id), title text not null, price numeric(10, 2) not null, status text...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'sal@example.com'), ('00000000-0000-0000-0000-000000000002', 'bea@example.com'), ('00000000-0000-0000-0000-000000000003', 'mo@example.com'); insert into public.moderators (user_id) values ('00000000-0000-0000-0000-000000000003'); ...
- name: anon_sees_public_listings covers: [R1] as: {role: anon} sql: select id from listings order by id expect: rows: - [1] - [5] - name: buyer_sees_public_and_own_listings covers: [R1, R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id from listings orde...
19
create schema private; grant usage on schema private to anon, authenticated; create function private.is_moderator() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.moderators m where m.user_id = auth.uid()) $$; create function private.listing_flag...
[ { "name": "privilege-escalation", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.is_moderator() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.moderators m where m.us...
T040
Survey results visible to owners only above a minimum group size
2
train
[ "view", "aggregate", "k-anonymity", "upsert" ]
[ "k-anonymity", "private-row-leak", "view-bypass" ]
[]
[ "survey 1 (olly …01): 4 responses, average 4.00", "survey 2 (olly): only 2 responses — below the threshold", "survey 3 (pat …06): 3 responses, average 3.00", "respondents …02–…05" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An employee-pulse app built with supabase-js. Respondents answer or change their answer with `supabase.from('survey_responses').upsert({ survey_id, respondent_id, score, comment }).select()`. Survey owners see results with `supabase.from('survey_results').select()`; individual answers must stay anonymous. R1. Signed-i...
create table public.surveys ( id bigint primary key, owner_id uuid not null references auth.users(id), title text not null ); create table public.survey_responses ( survey_id bigint not null references public.surveys(id), respondent_id uuid not null default auth.uid() references auth.users(id), score integ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'olly@example.com'), ('00000000-0000-0000-0000-000000000002', 'r1@example.com'), ('00000000-0000-0000-0000-000000000003', 'r2@example.com'), ('00000000-0000-0000-0000-000000000004', 'r3@example.com'), ('00000000-0000-0000-0000-...
- name: user_sees_all_surveys covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select count(*) from surveys expect: rows: - [3] - name: owner_creates_survey covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} client: op: inse...
16
alter table public.surveys enable row level security; alter table public.survey_responses enable row level security; create policy surveys_select on public.surveys for select to authenticated using (true); create policy surveys_insert on public.surveys for insert to authenticated with check (owner_id = auth.u...
[ { "name": "k-anonymity", "sql": "alter table public.surveys enable row level security;\nalter table public.survey_responses enable row level security;\n\ncreate policy surveys_select on public.surveys\n for select to authenticated\n using (true);\n\ncreate policy surveys_insert on public.surveys\n for in...
T041
Timesheets with locked pay periods and a service-role payroll import
2
train
[ "membership", "negative-condition", "service-role", "client-returning" ]
[ "service-role-broken", "negative-condition", "reference-check" ]
[]
[ "period 1 (Jan 2020) locked, period 2 (Jan 2030) open", "ana (…01) assigned to projects 1 and 2, ben (…02) to project 2; nobody to project 3", "ana's entry 1 is in the locked period" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A timesheet app built with supabase-js. Employees log time with `supabase.from('time_entries').insert({...}).select()` and edit entries with `.update({...}).eq('id', id).select()`. Finance locks a pay period once payroll has run. A nightly payroll import runs on the server with the service role and may need to correct ...
create table public.projects ( id bigint primary key, name text not null ); create table public.assignments ( project_id bigint not null references public.projects(id), user_id uuid not null references auth.users(id), primary key (project_id, user_id) ); create table public.periods ( id bigint primary key...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.projects (id, name) values (1, 'Website'), (2, 'Mobile app'), (3, 'Internal R&D'); insert into public.assignments (project_id, user...
- name: user_sees_own_entries covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from time_entries order by id expect: rows: - [1] - [2] - name: other_user_sees_only_own_entries covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000...
21
create schema private; grant usage on schema private to authenticated; create function private.is_assigned(p_project_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.assignments a where a.project_id = p_project_id and a.user_id = auth.uid...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_assigned(p_project_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.assignments a...
T044
Public status page with draft incidents and updates
1
train
[ "public-read", "parent-child", "read-only", "anon-read" ]
[ "child-leak", "private-row-leak", "anon-vs-authenticated" ]
[]
[ "draft incident 2 carries a published update (id 3)", "published incident 1 has a draft update (id 2)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A public status page built with supabase-js. Visitors load incidents with `supabase.from('incidents').select('*, incident_updates(*)')`. The on-call team writes incidents and updates from an internal tool that uses the service role; drafts stay unpublished until reviewed. R1. Anyone, including anonymous visitors, can ...
create table public.incidents ( id bigint primary key, title text not null, severity text not null check (severity in ('minor', 'major')), status text not null default 'investigating' check (status in ('investigating', 'resolved')), is_published boolean not null default false ); create table public.incident_...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'); insert into public.incidents (id, title, severity, status, is_published) values (1, 'API latency in ap-south-1', 'major', 'resolved', true), (2, 'Suspected credential leak', 'major', 'investigating', false); i...
- name: anon_reads_published_incidents covers: [R1] as: {role: anon} sql: select id from incidents order by id expect: rows: - [1] - name: signed_in_user_reads_published_incidents covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from incidents order...
11
alter table public.incidents enable row level security; alter table public.incident_updates enable row level security; create policy incidents_select on public.incidents for select to anon, authenticated using (is_published); create policy incident_updates_select on public.incident_updates for select to anon, a...
[ { "name": "anon-vs-authenticated", "sql": "alter table public.incidents enable row level security;\nalter table public.incident_updates enable row level security;\n\ncreate policy incidents_select on public.incidents\n for select to authenticated\n using (is_published);\n\ncreate policy incident_updates_s...
T045
Budget categories with shared built-in rows
1
train
[ "single-owner", "nullable-owner", "shared-defaults", "client-returning" ]
[ "over-broad-for-all", "null-owner" ]
[]
[ "built-in categories with NULL user_id: ids 1 and 2", "ana's (…01) category 3, ben's (…02) category 4" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A budgeting app built with supabase-js. Built-in categories have no `user_id` and are shared by everyone. Users add their own with `supabase.from('categories').insert({ user_id, name, color }).select()` and edit them with `.update({...}).eq('id', id).select()`. R1. Signed-in users can read the built-in categories and ...
create table public.categories ( id bigint generated by default as identity primary key, user_id uuid references auth.users(id), name text not null, color text not null default '#888888' );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.categories (id, user_id, name, color) values (1, null, 'Food', '#e76f51'), (2, null, 'Rent', '#264653'), (3, '00000000-0000-00...
- name: user_reads_builtin_and_own_categories covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from categories order by id expect: rows: - [1] - [2] - [3] - name: other_user_reads_builtin_and_own covers: [R1] as: {role: authenticated, sub: 000...
13
alter table public.categories enable row level security; create policy categories_select on public.categories for select to authenticated using (user_id is null or user_id = auth.uid()); create policy categories_insert on public.categories for insert to authenticated with check (user_id = auth.uid()); create...
[ { "name": "null-owner", "sql": "alter table public.categories enable row level security;\n\ncreate policy categories_select on public.categories\n for select to authenticated\n using (user_id is null or user_id = auth.uid());\n\ncreate policy categories_insert on public.categories\n for insert to authent...
T046
Avatar bucket where users write only their own file name
1
train
[ "storage-paths", "public-bucket", "single-owner" ]
[ "storage-path", "bucket-scope" ]
[ "storage.objects" ]
[ "ana's (…01) '<id>.png' and ben's (…02) '<id>.jpg' in avatars", "private bucket 'docs' with 'secret.pdf'" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A community app built with supabase-js and Supabase Storage. Each user's profile picture is stored in the bucket `avatars` at the top level, named `<user id>.png` or `<user id>.jpg`. The app uploads with `supabase.storage.from('avatars').upload(name, file, { upsert: true })`, which inserts or updates the object row and...
-- This task uses Supabase Storage only: storage.buckets and storage.objects already exist.
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into storage.buckets (id, name, public) values ('avatars', 'avatars', true), ('docs', 'docs', false); insert into storage.objects (bucket_id, n...
- name: anon_reads_avatars covers: [R1] as: {role: anon} sql: select name from storage.objects where bucket_id = 'avatars' order by name expect: rows: - [00000000-0000-0000-0000-000000000001.png] - [00000000-0000-0000-0000-000000000002.jpg] - name: user_cannot_read_private_bucket covers: [R3] a...
16
create policy avatars_select on storage.objects for select to anon, authenticated using (bucket_id = 'avatars'); create policy avatars_insert on storage.objects for insert to authenticated with check ( bucket_id = 'avatars' and name in (auth.uid()::text || '.png', auth.uid()::text || '.jpg') and ow...
[ { "name": "bucket-scope", "sql": "create policy avatars_select on storage.objects\n for select to anon, authenticated\n using (bucket_id = 'avatars');\n\ncreate policy avatars_insert on storage.objects\n for insert to authenticated\n with check (\n name in (auth.uid()::text || '.png', auth.uid()::tex...
T047
Poll voting with option checks and a closing time
2
train
[ "reference-check", "time-window", "upsert", "private-rows" ]
[ "reference-check", "time-window", "upsert-needs-update" ]
[]
[ "poll 1 open until 2099 (options 1, 2); poll 2 closed in 2020 (options 3, 4)", "ana (…01) voted option 1 on poll 1; ben (…02) voted option 3 on poll 2; cy (…03) has not voted" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A polling app built with supabase-js. Users vote, or change their vote, with `supabase.from('votes').upsert({ poll_id, user_id, option_id }).select()`, and withdraw with `.delete()`. Results are computed on the server. A poll is open while `closes_at` is in the future (compared with `now()`). R1. Signed-in users can r...
create table public.polls ( id bigint primary key, question text not null, closes_at timestamptz not null ); create table public.poll_options ( id bigint primary key, poll_id bigint not null references public.polls(id), label text not null ); create table public.votes ( poll_id bigint not null reference...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.polls (id, question, closes_at) values (1, 'Where should the offsite...
- name: user_reads_polls covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from polls expect: rows: - [2] - name: user_reads_options covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from pol...
17
create schema private; grant usage on schema private to authenticated; create function private.poll_open(p_poll_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select coalesce((select p.closes_at > now() from public.polls p where p.id = p_poll_id), false) $$; create funct...
[ { "name": "reference-check", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.poll_open(p_poll_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select coalesce((select p.closes_at > now() from public.p...
T048
Car-pool seat requests confirmed by the driver within seat limits
2
train
[ "aggregate-limit", "time-window", "state-transition", "column-restriction", "client-returning" ]
[ "aggregate-limit", "state-transition", "time-window" ]
[]
[ "ride 1 (dev …01, 2 seats, 2099): pia confirmed, quinn requested — one seat left", "ride 2 (dev, 2020) is in the past", "ride 3 (sana …05, 1 seat, 2099): raj confirmed (full), quinn requested" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A car-pooling app built with supabase-js. Passengers request a seat with `supabase.from('ride_bookings').insert({ ride_id, passenger_id }).select()` and withdraw with `.delete()`. Drivers answer with `.update({ status }).match({ ride_id, passenger_id }).select()`. Departure times are compared with `now()`. R1. Signed-...
create table public.rides ( id bigint primary key, driver_id uuid not null references auth.users(id), from_city text not null, to_city text not null, departs_at timestamptz not null, seats integer not null check (seats > 0) ); create table public.ride_bookings ( ride_id bigint not null references public....
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'dev@example.com'), ('00000000-0000-0000-0000-000000000002', 'pia@example.com'), ('00000000-0000-0000-0000-000000000003', 'quinn@example.com'), ('00000000-0000-0000-0000-000000000004', 'raj@example.com'), ('00000000-0000-0000-0...
- name: user_sees_all_rides covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000004} sql: select count(*) from rides expect: rows: - [3] - name: user_offers_ride covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000004} client: op: insert t...
19
create schema private; grant usage on schema private to authenticated; create function private.is_driver(p_ride_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.rides r where r.id = p_ride_id and r.driver_id = auth.uid()) $$; create func...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_driver(p_ride_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.rides r where r.id = ...
T049
Purchase orders with approval limits and no self-approval
2
train
[ "segregation-of-duties", "approval-limit", "append-only", "client-returning" ]
[ "self-approval", "approval-limit", "negative-condition" ]
[]
[ "approvers: abe (…02) limit 1,000; bea (…03) limit 50,000 — bea also requested PO 4", "rita (…01): PO 1 (500), 2 (800), 3 (20,000), 5 (900, already approved by abe)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A procurement app built with supabase-js. Requesters create purchase orders with `supabase.from('purchase_orders').insert({...}).select()`. An approver records a decision by inserting into `po_approvals` with `.insert({ po_id, approver_id, decision }).select()`; a PO is decided once it has an approval row. Approvers an...
create table public.approvers ( user_id uuid primary key references auth.users(id), limit_amount numeric(12, 2) not null ); create table public.purchase_orders ( id bigint generated by default as identity primary key, requester_id uuid not null default auth.uid() references auth.users(id), vendor text not nu...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'rita@example.com'), ('00000000-0000-0000-0000-000000000002', 'abe@example.com'), ('00000000-0000-0000-0000-000000000003', 'bea@example.com'); insert into public.approvers (user_id, limit_amount) values ('00000000-0000-0000-0000-0...
- name: requester_sees_own_pos covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from purchase_orders order by id expect: rows: - [1] - [2] - [3] - [5] - name: approver_sees_every_po covers: [R1] as: {role: authenticated, sub: 00000000-0000...
22
create schema private; grant usage on schema private to authenticated; create function private.approver_limit() returns numeric language sql stable security definer set search_path = '' as $$ select a.limit_amount from public.approvers a where a.user_id = auth.uid() $$; create function private.po_decided(p_po_id b...
[ { "name": "approval-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.approver_limit() returns numeric\nlanguage sql stable security definer set search_path = ''\nas $$\n select a.limit_amount from public.approvers a where a.user_id = auth....
T050
School grades visible to students, guardians and their teachers
2
train
[ "roles-by-table", "delegated-access", "reference-check", "client-returning" ]
[ "private-row-leak", "reference-check", "privilege-escalation" ]
[]
[ "teacher tina (…01) class 1; teacher tom (…02) class 2", "sid (…03) in classes 1 and 2; sue (…04) in class 1; sam (…06) only in class 2", "guardian gus (…05) of sid" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A school app built with supabase-js. Teachers record grades with `supabase.from('grades').insert({...}).select()` and correct them with `.update({...}).eq('id', id).select()`. `guardians` links parents to their children. R1. Students can read their own grades. Guardians can read the grades of the students they are gua...
create table public.classes ( id bigint primary key, teacher_id uuid not null references auth.users(id), name text not null ); create table public.class_students ( class_id bigint not null references public.classes(id), student_id uuid not null references auth.users(id), primary key (class_id, student_id) ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'tina@example.com'), ('00000000-0000-0000-0000-000000000002', 'tom@example.com'), ('00000000-0000-0000-0000-000000000003', 'sid@example.com'), ('00000000-0000-0000-0000-000000000004', 'sue@example.com'), ('00000000-0000-0000-00...
- name: student_reads_own_grades covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select id from grades order by id expect: rows: - [1] - [3] - name: classmate_reads_only_own_grades covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-0000000...
21
create schema private; grant usage on schema private to authenticated; create function private.teaches(p_class_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.classes c where c.id = p_class_id and c.teacher_id = auth.uid()) $$; create f...
[ { "name": "private-row-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.teaches(p_class_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.classes c where c.id ...
T052
Folder tree where grants inherit to every subfolder
3
train
[ "hierarchy", "recursive-cte", "security-definer-helper", "inheritance", "client-returning" ]
[ "inheritance-missing", "recursive-policy", "reference-check" ]
[]
[ "tree: 1 Company → 2 HR → 3 Payroll; 1 → 4 Marketing → 6 Campaigns (all owned by ana …01); 5 is ben's (…02) own root", "grants: hal (…03) read on HR (inherits to Payroll), mia (…04) edit on Marketing (inherits to Campaigns) and read on HR, pat (…05) read on Payroll only" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A document-management app built with supabase-js. Folders form a tree through `parent_id`. Access is given on a folder through `folder_grants` (read, or edit when `can_edit`), and owning or being granted a folder applies to every folder below it. Writes read the row back with `.select()`. R1. Users can read a folder a...
create table public.folders ( id bigint generated by default as identity primary key, parent_id bigint references public.folders(id), owner_id uuid not null default auth.uid() references auth.users(id), name text not null ); create table public.folder_grants ( folder_id bigint not null references public.fold...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'hal@example.com'), ('00000000-0000-0000-0000-000000000004', 'mia@example.com'), ('00000000-0000-0000-000...
- name: owner_reads_whole_tree covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from folders order by id expect: rows: - [1] - [2] - [3] - [4] - [6] - name: read_grant_inherits_to_subfolder covers: [R1] as: {role: authenticated, sub: 0...
21
create schema private; grant usage on schema private to authenticated; create function private.folder_access(p_folder_id bigint) returns text language sql stable security definer set search_path = '' as $$ with recursive chain as ( select f.id, f.parent_id, f.owner_id from public.folders f where f.id = p_folder...
[ { "name": "inheritance-missing", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.folder_access(p_folder_id bigint) returns text\nlanguage sql stable security definer set search_path = ''\nas $$\n select case\n when exists (select 1 from public...
T053
Production access granted only after two different ops approvals
3
train
[ "rpc", "security-definer", "four-eyes", "state-transition", "client-returning" ]
[ "self-approval", "duplicate-approval", "state-transition" ]
[]
[ "ops team: oli (…01), opa (…02), ozz (…03); requesters rhea (…04), sam (…05)", "request 1 (rhea) has one approval (oli); request 3 is oli's own with one approval (opa); request 4 already granted", "access_approvals has no unique constraint, so the function must refuse repeat approvals itself" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An internal tool built with supabase-js for requesting production access. Requests are created with `supabase.from('access_requests').insert({ resource, reason }).select()`. Ops team members approve with `supabase.rpc('approve_access', { p_request_id })`. Implement it as `public.approve_access(p_request_id bigint) retu...
create table public.ops_team ( user_id uuid primary key references auth.users(id) ); create table public.access_requests ( id bigint generated by default as identity primary key, requester_id uuid not null default auth.uid() references auth.users(id), resource text not null, reason text not null, status te...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'oli@example.com'), ('00000000-0000-0000-0000-000000000002', 'opa@example.com'), ('00000000-0000-0000-0000-000000000003', 'ozz@example.com'), ('00000000-0000-0000-0000-000000000004', 'rhea@example.com'), ('00000000-0000-0000-00...
- name: requester_sees_own_requests covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000004} sql: select id from access_requests order by id expect: rows: - [1] - [4] - name: ops_sees_every_request covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-0000...
24
create schema private; grant usage on schema private to authenticated; create function private.is_ops() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.ops_team o where o.user_id = auth.uid()) $$; alter table public.ops_team enable row level secur...
[ { "name": "duplicate-approval", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_ops() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.ops_team o where o.user_id = auth.uid...
T054
Public and private recipes with user favourites
1
train
[ "public-read", "single-owner", "reference-check", "client-returning" ]
[ "reference-check", "ownership-change", "private-row-leak" ]
[]
[ "ana's (…01) private recipe 2", "favourites: ben → recipe 1, ana → recipe 3", "user with nothing: cy (…03)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A recipe site built with supabase-js. Authors write recipes with `.insert({...}).select()` and edit them with `.update({...}).eq('id', id).select()`. Users save favourites with `supabase.from('favorites').insert({ user_id, recipe_id }).select()` and remove them with `.delete()`. R1. Anyone, including anonymous visitor...
create table public.recipes ( id bigint generated by default as identity primary key, author_id uuid not null default auth.uid() references auth.users(id), title text not null, is_public boolean not null default false ); create table public.favorites ( user_id uuid not null default auth.uid() references auth...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.recipes (id, author_id, title, is_public) values (1, '00000000-0000-...
- name: anon_reads_public_recipes covers: [R1] as: {role: anon} sql: select id from recipes order by id expect: rows: - [1] - [3] - name: author_reads_own_private_recipe covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from recipes order by id ...
18
alter table public.recipes enable row level security; alter table public.favorites enable row level security; create policy recipes_select on public.recipes for select to anon, authenticated using (is_public or author_id = auth.uid()); create policy recipes_insert on public.recipes for insert to authenticated ...
[ { "name": "ownership-change", "sql": "alter table public.recipes enable row level security;\nalter table public.favorites enable row level security;\n\ncreate policy recipes_select on public.recipes\n for select to anon, authenticated\n using (is_public or author_id = auth.uid());\n\ncreate policy recipes...
T056
Flashcard decks whose cards follow the deck's visibility
1
train
[ "public-read", "parent-child", "ownership", "client-returning" ]
[ "child-leak", "ownership-change" ]
[]
[ "ana's (…01) public deck 1 and private deck 2 (card 3)", "ben's (…02) public deck 3 (card 4)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A flashcard app built with supabase-js. Decks belong to an owner and can be public. Cards are added with `supabase.from('cards').insert({ deck_id, front, back }).select()` and edited with `.update({...}).eq('id', id).select()`. R1. Anyone, including anonymous visitors, can read public decks and their cards. Owners can...
create table public.decks ( id bigint primary key, owner_id uuid not null references auth.users(id), name text not null, is_public boolean not null default false ); create table public.cards ( id bigint generated by default as identity primary key, deck_id bigint not null references public.decks(id) on del...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.decks (id, owner_id, name, is_public) values (1, '00000000-0000-0000-0000-000000000001', 'Hindi basics', true), (2, '00000000-00...
- name: anon_reads_public_decks covers: [R1] as: {role: anon} sql: select id from decks order by id expect: rows: - [1] - [3] - name: anon_reads_cards_of_public_decks covers: [R1] as: {role: anon} sql: select id from cards order by id expect: rows: - [1] - [2] - [4] - name:...
15
alter table public.decks enable row level security; alter table public.cards enable row level security; create policy decks_select on public.decks for select to anon, authenticated using (is_public or owner_id = auth.uid()); create policy decks_insert on public.decks for insert to authenticated with check (ow...
[ { "name": "child-leak", "sql": "alter table public.decks enable row level security;\nalter table public.cards enable row level security;\n\ncreate policy decks_select on public.decks\n for select to anon, authenticated\n using (is_public or owner_id = auth.uid());\n\ncreate policy decks_insert on public.d...
T057
Clinic appointment slots booked by claiming an open slot
2
train
[ "claim-a-row", "time-window", "column-restriction", "private-rows" ]
[ "time-window", "private-row-leak", "old-vs-new" ]
[]
[ "providers ira (…01) and jo (…02)", "slot 2 booked by pat (…03), slot 4 by quin (…04); slot 3 is open but in the past (2020)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A clinic booking app built with supabase-js. Providers' slots are created by a server tool using the service role. Patients book a slot with `supabase.from('slots').update({ booked_by: userId }).eq('id', slotId).select()` and cancel with `.update({ booked_by: null }).eq('id', slotId)`. Times are compared with `now()`. ...
create table public.providers ( user_id uuid primary key references auth.users(id), name text not null ); create table public.slots ( id bigint primary key, provider_id uuid not null references public.providers(user_id), starts_at timestamptz not null, booked_by uuid references auth.users(id) );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ira@example.com'), ('00000000-0000-0000-0000-000000000002', 'jo@example.com'), ('00000000-0000-0000-0000-000000000003', 'pat@example.com'), ('00000000-0000-0000-0000-000000000004', 'quin@example.com'); insert into public.provid...
- name: user_sees_providers covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from providers expect: rows: - [2] - name: patient_sees_open_future_and_own_slots covers: [R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sq...
16
alter table public.providers enable row level security; alter table public.slots enable row level security; revoke update on public.slots from anon, authenticated; grant update (booked_by) on public.slots to authenticated; create policy providers_select on public.providers for select to authenticated using (true)...
[ { "name": "old-vs-new", "sql": "alter table public.providers enable row level security;\nalter table public.slots enable row level security;\n\ncreate policy providers_select on public.providers\n for select to authenticated\n using (true);\n\ncreate policy slots_select on public.slots\n for select to au...
T059
Hackathon submissions that lock at the deadline and open to judges after it
2
train
[ "time-window", "membership", "judges", "upsert" ]
[ "private-row-leak", "time-window", "reference-check" ]
[]
[ "event 1 deadline 2099 (still open), event 2 deadline 2020 (closed)", "team 1 (al …01, bo …02) and team 2 (cy …03) in event 1; team 3 (cy) in event 2", "judges: jj (…04) for event 1, kk (…05) for event 2" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A hackathon platform built with supabase-js. Each team has one submission, saved with `supabase.from('submissions').upsert({ team_id, repo_url, notes }).select()`. Deadlines are compared with `now()`. R1. Signed-in users can see every event and team. Users can see their own team memberships. R2. Team members can see t...
create table public.events ( id bigint primary key, name text not null, deadline timestamptz not null ); create table public.teams ( id bigint primary key, event_id bigint not null references public.events(id), name text not null ); create table public.team_members ( team_id bigint not null references p...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'al@example.com'), ('00000000-0000-0000-0000-000000000002', 'bo@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'jj@example.com'), ('00000000-0000-0000-0000-00...
- name: user_sees_events_and_teams covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select count(*) from teams expect: rows: - [3] - name: user_sees_own_memberships covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select ...
18
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_team_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.team_members m where m.team_id = p_team_id and m.user_id = auth.uid()) $$; c...
[ { "name": "private-row-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_team_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.team_members m where...
T063
Document checkout locks enforced through RPCs
3
train
[ "rpc", "security-definer", "locking", "state-transition", "read-only-tables" ]
[ "state-transition", "rpc-missing-auth-check", "lock-bypass", "privilege-escalation" ]
[]
[ "doc 2 checked out by ana (…01); doc 4 checked out by ben (…02)", "ana can edit docs 1, 2 and 4; ben can edit 1, 3 and 4; cy (…03) can only read doc 1" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A document editor built with supabase-js that uses check-out locks. Users lock a document with `supabase.rpc('checkout_document', { p_doc_id })` and save and unlock it with `supabase.rpc('checkin_document', { p_doc_id, p_body })`. Implement them as `public.checkout_document(p_doc_id bigint) returns void` and `public.ch...
create table public.documents ( id bigint primary key, title text not null, body text not null default '', checked_out_by uuid references auth.users(id) ); create table public.doc_access ( doc_id bigint not null references public.documents(id), user_id uuid not null references auth.users(id), can_edit bo...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.documents (id, title, body, checked_out_by) values (1, 'Spec', 'v1',...
- name: editor_reads_accessible_documents covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from documents order by id expect: rows: - [1] - [2] - [4] - name: reader_reads_only_shared_document covers: [R1] as: {role: authenticated, sub: 0000000...
18
create schema private; grant usage on schema private to authenticated; create function private.can_read(p_doc_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.doc_access a where a.doc_id = p_doc_id and a.user_id = auth.uid()) $$; alter t...
[ { "name": "lock-bypass", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.can_read(p_doc_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.doc_access a where a.doc_id...
T066
Daily API usage with a per-user summary view
1
train
[ "view", "security-invoker", "aggregate", "read-only" ]
[ "view-bypass", "private-row-leak" ]
[]
[ "ana (…01): two days of usage (100 and 50 requests); ben (…02): one day (7)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A developer dashboard built with supabase-js. Server code records daily API usage. The dashboard shows a chart with `supabase.from('api_usage').select()` and totals with `supabase.from('usage_summary').select()`. R1. Users can read only their own daily usage rows. R2. Provide a view `public.usage_summary` with exactly...
create table public.api_usage ( user_id uuid not null references auth.users(id), day date not null, requests integer not null check (requests >= 0), primary key (user_id, day) );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.api_usage (user_id, day, requests) values ('00000000-0000-0000-0000-000000000001', '2020-01-01', 100), ('00000000-0000-0000-0000...
- name: user_reads_own_daily_usage covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select day, requests from api_usage order by day expect: rows: - ['2020-01-01', 100] - ['2020-01-02', 50] - name: user_cannot_read_someone_elses_usage covers: [R1] as: {role...
10
alter table public.api_usage enable row level security; create policy api_usage_select on public.api_usage for select to authenticated using (user_id = auth.uid()); create view public.usage_summary with (security_invoker = true) as select user_id, sum(requests)::bigint as total_requests, count(*)::bigint as act...
[ { "name": "private-row-leak", "sql": "alter table public.api_usage enable row level security;\n\ncreate policy api_usage_select on public.api_usage\n for select to authenticated\n using (true);\n\ncreate view public.usage_summary\nwith (security_invoker = true) as\n select user_id, sum(requests)::bigint ...
T068
Course forum with locked threads and TA moderation
2
train
[ "membership", "role-column", "negative-condition", "moderation", "client-returning" ]
[ "negative-condition", "privilege-escalation", "reference-check" ]
[]
[ "course 1: students ana (…01) and ben (…02), TA tara (…03); course 2: student cy (…04)", "thread 2 in course 1 is locked; thread 1 was started by ana" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A course discussion forum built with supabase-js. Course members are students or teaching assistants (TAs). Threads and posts are created with `.insert({...}).select()` and edited with `.update({...}).eq('id', id).select()`. R1. Course members can see their courses, their own enrollment rows, and every thread and post...
create table public.courses ( id bigint primary key, name text not null ); create table public.enrollments ( course_id bigint not null references public.courses(id), user_id uuid not null references auth.users(id), role text not null check (role in ('student', 'ta')), primary key (course_id, user_id) ); c...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'tara@example.com'), ('00000000-0000-0000-0000-000000000004', 'cy@example.com'); insert into public.course...
- name: member_reads_course_posts covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from posts order by id expect: rows: - [1] - [2] - [3] - name: other_course_member_reads_only_own_course covers: [R1] as: {role: authenticated, sub: 00000000-00...
22
create schema private; grant usage on schema private to authenticated; create function private.course_role(p_course_id bigint) returns text language sql stable security definer set search_path = '' as $$ select e.role from public.enrollments e where e.course_id = p_course_id and e.user_id = auth.uid() $$; create f...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.course_role(p_course_id bigint) returns text\nlanguage sql stable security definer set search_path = ''\nas $$\n select e.role from public.enrollments e where e.cours...
T069
Paywalled articles for users with an active subscription
2
train
[ "paywall", "time-window", "jwt-claims", "anon-read", "server-written" ]
[ "time-window", "claim-trust", "anon-vs-authenticated" ]
[]
[ "ana (…01) pro until 2099; ben (…02) pro that ended in 2020; cy (…03) free plan; dee (…04) no subscription row", "eve (…05) has no subscription but user_metadata plan=pro", "articles 2 and 3 are premium" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A news site built with supabase-js. Articles load with `supabase.from('articles').select()`. Subscriptions are written by the payment provider's webhook, which runs on the server with the service role; a subscription is active while `current_period_end` is in the future (compared with `now()`). Users can edit their own...
create table public.articles ( id bigint primary key, title text not null, body text not null, is_premium boolean not null default false ); create table public.subscriptions ( user_id uuid primary key references auth.users(id), plan text not null check (plan in ('free', 'pro')), current_period_end timest...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'), ('00000000-0000-0000-0000...
- name: anon_reads_free_articles covers: [R1] as: {role: anon} sql: select id from articles order by id expect: rows: - [1] - [4] - name: active_pro_reads_everything covers: [R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from articles order by id ex...
12
create schema private; grant usage on schema private to anon, authenticated; create function private.has_pro() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.subscriptions s where s.user_id = auth.uid() and s.plan = 'pro' and s.current_period_end ...
[ { "name": "anon-vs-authenticated", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.has_pro() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.subscriptions s where s.use...
T070
Lost and found where finders approve one claim per item
2
train
[ "state-transition", "aggregate-limit", "client-returning", "column-restriction" ]
[ "self-approval", "aggregate-limit", "reference-check" ]
[]
[ "finder fay (…01): item 1 open, item 2 claimed", "claims: gil (…02) and hal (…03) pending on item 1; ivy (…04) approved and hal pending on item 2", "new user jo (…05)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A campus lost-and-found built with supabase-js. Finders post items; people who lost something file a claim with `supabase.from('claims').insert({ item_id, claimant_id, message }).select()`. Finders answer with `.update({ status }).eq('id', id).select()`. R1. Signed-in users can see every item. Finders can post items a...
create table public.items ( id bigint generated by default as identity primary key, found_by uuid not null default auth.uid() references auth.users(id), description text not null, status text not null default 'open' check (status in ('open', 'claimed')) ); create table public.claims ( id bigint generated by ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'fay@example.com'), ('00000000-0000-0000-0000-000000000002', 'gil@example.com'), ('00000000-0000-0000-0000-000000000003', 'hal@example.com'), ('00000000-0000-0000-0000-000000000004', 'ivy@example.com'), ('00000000-0000-0000-000...
- name: user_sees_all_items covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000005} sql: select count(*) from items expect: rows: - [2] - name: user_posts_found_item covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000005} client: op: insert ...
19
create schema private; grant usage on schema private to authenticated; create function private.is_finder(p_item_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.items i where i.id = p_item_id and i.found_by = auth.uid()) $$; create funct...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_finder(p_item_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.items i where i.id = ...
T071
Fleet trips allowed only within the driver's assignment dates
2
train
[ "date-ranges", "reference-check", "manager-role", "client-returning" ]
[ "reference-check", "date-boundary", "privilege-escalation" ]
[]
[ "dia (…02) drives vehicle 1 from 2020-01-01 to 2020-01-31 (inclusive); eli (…03) drives vehicle 1 in February 2020 and vehicle 2 all of 2020", "fleet manager mo (…01)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A fleet app built with supabase-js. Fleet managers (users in `fleet_managers`) assign drivers to vehicles for date ranges; both `starts_on` and `ends_on` are included. Drivers log trips with `supabase.from('trips').insert({ vehicle_id, driver_id, trip_date, km }).select()` and correct them with `.update({...}).eq('id',...
create table public.fleet_managers ( user_id uuid primary key references auth.users(id) ); create table public.vehicles ( id bigint primary key, plate text not null unique ); create table public.assignments ( id bigint generated by default as identity primary key, vehicle_id bigint not null references publi...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'mo@example.com'), ('00000000-0000-0000-0000-000000000002', 'dia@example.com'), ('00000000-0000-0000-0000-000000000003', 'eli@example.com'); insert into public.fleet_managers (user_id) values ('00000000-0000-0000-0000-000000000001...
- name: driver_sees_own_trips covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id from trips order by id expect: rows: - [1] - name: manager_sees_all_trips covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select co...
19
create schema private; grant usage on schema private to authenticated; create function private.is_manager() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.fleet_managers m where m.user_id = auth.uid()) $$; create function private.covered(p_vehicl...
[ { "name": "date-boundary", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_manager() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.fleet_managers m where m.user_id = aut...
T072
Escrow marketplace orders whose states change only through RPCs
3
train
[ "rpc", "security-definer", "state-machine", "reference-check", "client-returning" ]
[ "rpc-missing-auth-check", "state-transition", "reference-check" ]
[]
[ "seller sel (…01) lists 1 (₹500) and 2 (₹1200); buyer buy (…02); outsider oth (…03)", "orders: 1 paid, 2 shipped, 3 pending_payment, 4 released" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An escrow marketplace built with supabase-js. Buyers place orders with `supabase.from('orders').insert({ listing_id, buyer_id, seller_id, amount }).select()`. The payment provider's webhook (server, service role) moves an order from `pending_payment` to `paid`. After that the app calls `supabase.rpc('mark_shipped' | 'r...
create table public.listings ( id bigint primary key, seller_id uuid not null references auth.users(id), title text not null, price numeric(10, 2) not null check (price > 0) ); create table public.orders ( id bigint generated by default as identity primary key, listing_id bigint not null references public....
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'sel@example.com'), ('00000000-0000-0000-0000-000000000002', 'buy@example.com'), ('00000000-0000-0000-0000-000000000003', 'oth@example.com'); insert into public.listings (id, seller_id, title, price) values (1, '00000000-0000-00...
- name: buyer_sees_own_orders covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select count(*) from orders expect: rows: - [4] - name: seller_sees_orders_on_own_listings covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: se...
25
alter table public.listings enable row level security; alter table public.orders enable row level security; create policy listings_select on public.listings for select to authenticated using (true); create policy orders_select on public.orders for select to authenticated using (buyer_id = auth.uid() or seller...
[ { "name": "reference-check", "sql": "alter table public.listings enable row level security;\nalter table public.orders enable row level security;\n\ncreate policy listings_select on public.listings\n for select to authenticated\n using (true);\n\ncreate policy orders_select on public.orders\n for select ...
T075
Journal entries editable only for 24 hours after writing
1
train
[ "single-owner", "time-window", "column-restriction" ]
[ "time-window", "old-vs-new" ]
[]
[ "ana's (…01) entry 1 and ben's (…02) entry 2 were written in 2020, so they are permanent", "fresh entries get created_at = now(), so tests create one and edit it in the same test" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A private journaling app built with supabase-js. Entries are written with `supabase.from('journal_entries').insert({ user_id, body, mood }).select()`; `created_at` defaults to the time of writing. Edits use `.update({ body, mood }).eq('id', id)`. Time is compared with `now()`. R1. Users can read and write only their o...
create table public.journal_entries ( id bigint generated by default as identity primary key, user_id uuid not null default auth.uid() references auth.users(id), body text not null, mood integer not null check (mood between 1 and 5), created_at timestamptz not null default now() );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.journal_entries (id, user_id, body, mood, created_at) values (1, '00000000-0000-0000-0000-000000000001', 'First entry', 3, '2020-0...
- name: user_reads_own_entries covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from journal_entries order by id expect: rows: - [1] - name: user_writes_entry covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} client: ...
12
alter table public.journal_entries enable row level security; revoke insert, update on public.journal_entries from anon, authenticated; grant insert (user_id, body, mood) on public.journal_entries to authenticated; grant update (body, mood) on public.journal_entries to authenticated; create policy journal_select on p...
[ { "name": "old-vs-new", "sql": "alter table public.journal_entries enable row level security;\n\ncreate policy journal_select on public.journal_entries\n for select to authenticated\n using (user_id = auth.uid());\n\ncreate policy journal_insert on public.journal_entries\n for insert to authenticated\n ...
T076
Link-in-bio pages that only accept https links
1
train
[ "public-read", "single-owner", "input-validation", "client-returning" ]
[ "unsafe-url", "private-row-leak" ]
[]
[ "ana (…01): visible link 1 and hidden link 2; ben (…02): visible link 3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A link-in-bio site built with supabase-js. Each user's public page lists their visible links. Owners add links with `supabase.from('bio_links').insert({...}).select()` and edit them with `.update({...}).eq('id', id).select()`. Pages render `url` directly as an anchor `href`. R1. Anyone, including anonymous visitors, c...
create table public.bio_links ( id bigint generated by default as identity primary key, user_id uuid not null default auth.uid() references auth.users(id), title text not null, url text not null, position integer not null default 0, is_visible boolean not null default true );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.bio_links (id, user_id, title, url, position, is_visible) values (1, '00000000-0000-0000-0000-000000000001', 'Portfolio', 'https:/...
- name: anon_reads_visible_links covers: [R1] as: {role: anon} sql: select id from bio_links order by id expect: rows: - [1] - [3] - name: owner_reads_own_hidden_link covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from bio_links order by id ...
12
alter table public.bio_links enable row level security; create policy bio_links_select on public.bio_links for select to anon, authenticated using (is_visible or user_id = auth.uid()); create policy bio_links_insert on public.bio_links for insert to authenticated with check (user_id = auth.uid() and url like ...
[ { "name": "private-row-leak", "sql": "alter table public.bio_links enable row level security;\n\ncreate policy bio_links_select on public.bio_links\n for select to anon, authenticated\n using (true);\n\ncreate policy bio_links_insert on public.bio_links\n for insert to authenticated\n with check (user_i...
T078
Family chores that children mark done and parents approve
2
train
[ "roles-by-table", "self-approval", "old-vs-new", "client-returning" ]
[ "self-approval", "privilege-escalation", "negative-condition" ]
[]
[ "household 1: parents pa (…01) and ma (…02), children kid1 (…03) and kid2 (…04); household 2: parent pz (…05), child kz (…06)", "chore 1 todo (kid1), chore 2 done (kid2), chore 3 approved (kid1)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A family chores app built with supabase-js. Parents create chores with `supabase.from('chores').insert({...}).select()`. Children mark a chore done, and parents approve it, with `.update({...}).eq('id', id).select()`, which sends every field of the chore. R1. Household members can see their household, its members and ...
create table public.households ( id bigint primary key, name text not null ); create table public.household_members ( household_id bigint not null references public.households(id), user_id uuid not null references auth.users(id), role text not null check (role in ('parent', 'child')), primary key (househol...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'pa@example.com'), ('00000000-0000-0000-0000-000000000002', 'ma@example.com'), ('00000000-0000-0000-0000-000000000003', 'kid1@example.com'), ('00000000-0000-0000-0000-000000000004', 'kid2@example.com'), ('00000000-0000-0000-000...
- name: child_sees_household_chores covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select id from chores order by id expect: rows: - [1] - [2] - [3] - name: other_household_sees_only_own covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0...
19
create schema private; grant usage on schema private to authenticated; create function private.household_role(p_household_id bigint) returns text language sql stable security definer set search_path = '' as $$ select m.role from public.household_members m where m.household_id = p_household_id and m.user_id = auth.u...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.household_role(p_household_id bigint) returns text\nlanguage sql stable security definer set search_path = ''\nas $$\n select m.role from public.household_members m w...
T079
Feature flags where developers may change only dev flags
2
train
[ "membership", "role-column", "environment-scoping", "client-returning" ]
[ "privilege-escalation", "weak-with-check", "recursive-policy" ]
[]
[ "org 1: developer dev1 (…01), admin adm (…02); org 2: developer dev2 (…03)", "org 1 has 'new-ui' in dev (flag 1) and prod (flag 2); org 2 has a prod flag 3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A feature-flag service built with supabase-js. Each organization has flags in two environments, `dev` and `prod`. Flags are created with `supabase.from('flags').insert({...}).select()` and toggled with `.update({...}).eq('id', id).select()`. R1. Members can see their organization, its members and all of its flags in b...
create table public.orgs ( id bigint primary key, name text not null ); create table public.org_members ( org_id bigint not null references public.orgs(id), user_id uuid not null references auth.users(id), role text not null check (role in ('developer', 'admin')), primary key (org_id, user_id) ); create t...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'dev1@example.com'), ('00000000-0000-0000-0000-000000000002', 'adm@example.com'), ('00000000-0000-0000-0000-000000000003', 'dev2@example.com'); insert into public.orgs (id, name) values (1, 'Acme'), (2, 'Globex'); insert into pub...
- name: member_sees_org_flags covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from flags order by id expect: rows: - [1] - [2] - name: other_org_member_sees_only_own covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003...
15
create schema private; grant usage on schema private to authenticated; create function private.org_role(p_org_id bigint) returns text language sql stable security definer set search_path = '' as $$ select m.role from public.org_members m where m.org_id = p_org_id and m.user_id = auth.uid() $$; alter table public.o...
[ { "name": "privilege-escalation", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.org_role(p_org_id bigint) returns text\nlanguage sql stable security definer set search_path = ''\nas $$\n select m.role from public.org_members m where m.org_id = ...
T080
Lab results that patients see only after the doctor releases them
2
train
[ "time-window", "care-team", "release-gating", "client-returning" ]
[ "time-window", "private-row-leak", "negative-condition" ]
[]
[ "patient pam (…01): result 1 released 2020, result 2 unreleased, result 3 scheduled for 2099", "patient pete (…02): result 4 released", "doctor doc (…03) in pam's care team" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A patient portal built with supabase-js. Doctors add results with `supabase.from('lab_results').insert({...}).select()` and release them to the patient, now or at a later time, with `.update({ released_at }).eq('id', id).select()`. A result is released once `released_at` is set and not in the future (compared with `now...
create table public.patients ( id bigint primary key, user_id uuid not null unique references auth.users(id) ); create table public.care_team ( patient_id bigint not null references public.patients(id), doctor_id uuid not null references auth.users(id), primary key (patient_id, doctor_id) ); create table pu...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'pam@example.com'), ('00000000-0000-0000-0000-000000000002', 'pete@example.com'), ('00000000-0000-0000-0000-000000000003', 'doc@example.com'); insert into public.patients (id, user_id) values (1, '00000000-0000-0000-0000-000000000...
- name: patient_sees_released_results covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from lab_results order by id expect: rows: - [1] - name: patient_cannot_see_unreleased_result covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-00...
17
create schema private; grant usage on schema private to authenticated; create function private.is_patient(p_patient_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.patients p where p.id = p_patient_id and p.user_id = auth.uid()) $$; cre...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_patient(p_patient_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.patients p whe...
T083
Cross-tenant item sharing with expiring shares and no resharing
3
train
[ "multi-tenant", "jwt-claims", "sharing", "expiry", "client-returning" ]
[ "claim-trust", "time-window", "transitive-delegation" ]
[]
[ "acme admin (…01), acme member (…02), globex admin (…03), globex member (…04); eve (…05) is a globex member whose user_metadata claims acme admin", "item 1 shared with globex (no expiry); item 2's share to globex expired in 2020" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A B2B portal built with supabase-js. The server puts each user's tenant and role in the JWT as `app_metadata.tenant_id` and `app_metadata.role` (`admin` or `member`); users can edit their `user_metadata`. A tenant can share an item with another tenant through `item_shares`, optionally until `expires_at` (compared with ...
create table public.items ( id bigint generated by default as identity primary key, tenant_id text not null, title text not null ); create table public.item_shares ( item_id bigint not null references public.items(id) on delete cascade, target_tenant text not null, expires_at timestamptz, primary key (it...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'acme_admin@example.com'), ('00000000-0000-0000-0000-000000000002', 'acme_member@example.com'), ('00000000-0000-0000-0000-000000000003', 'glob_admin@example.com'), ('00000000-0000-0000-0000-000000000004', 'glob_member@example.com...
- name: member_sees_own_and_shared_items covers: [R1] as: role: authenticated sub: 00000000-0000-0000-0000-000000000004 claims: app_metadata: {tenant_id: globex, role: member} sql: select id from items order by id expect: rows: - [1] - [3] - name: owner_tenant_sees_own_items cov...
18
create schema private; grant usage on schema private to authenticated; create function private.tenant() returns text language sql stable as $$ select auth.jwt() -> 'app_metadata' ->> 'tenant_id' $$; create function private.is_admin() returns boolean language sql stable as $$ select coalesce(auth.jwt() -> 'app_me...
[ { "name": "claim-trust", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.tenant() returns text\nlanguage sql stable\nas $$\n select coalesce(auth.jwt() -> 'user_metadata' ->> 'tenant_id', auth.jwt() -> 'app_metadata' ->> 'tenant_id')\n$$;\n\ncrea...
T085
Public sticky-note board where only moderators pin notes
1
train
[ "public-read", "single-owner", "column-restriction", "client-returning" ]
[ "privilege-escalation", "over-broad-for-all" ]
[]
[ "ana's (…01) note 1 is pinned (by a moderator); ben's (…02) note 2 is not" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A community notice board built with supabase-js. Users post with `supabase.from('board_notes').insert({ author_id, body, color }).select()` and edit with `.update({ body, color }).eq('id', id).select()`. Moderators pin notes from an admin tool that uses the service role. R1. Anyone, including anonymous visitors, can r...
create table public.board_notes ( id bigint generated by default as identity primary key, author_id uuid not null default auth.uid() references auth.users(id), body text not null, color text not null default 'yellow', is_pinned boolean not null default false, created_at timestamptz not null default '2020-01...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.board_notes (id, author_id, body, color, is_pinned) values (1, '00000000-0000-0000-0000-000000000001', 'Office closed on Friday', ...
- name: anon_reads_all_notes covers: [R1] as: {role: anon} sql: select id from board_notes order by id expect: rows: - [1] - [2] - name: user_posts_note covers: [R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} client: op: insert table: board_notes values: ...
12
alter table public.board_notes enable row level security; revoke insert, update on public.board_notes from anon, authenticated; grant insert (author_id, body, color) on public.board_notes to authenticated; grant update (body, color) on public.board_notes to authenticated; create policy board_notes_select on public.bo...
[ { "name": "over-broad-for-all", "sql": "alter table public.board_notes enable row level security;\n\nrevoke insert, update on public.board_notes from anon, authenticated;\ngrant insert (author_id, body, color) on public.board_notes to authenticated;\ngrant update (body, color) on public.board_notes to authe...
T086
Event check-ins allowed only while the event is live
1
train
[ "single-owner", "time-window", "column-restriction", "append-only" ]
[ "time-window", "old-vs-new" ]
[]
[ "event 1 is live (2020 to 2099); event 2 is over; event 3 starts in 2099", "ana (…01) already checked in to event 2" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An event app built with supabase-js. Attendees scan a QR code that runs `supabase.from('checkins').insert({ event_id, user_id }).select()`; `checked_in_at` defaults to the current time. An event is live from `starts_at` to `ends_at`, compared with `now()`. R1. Signed-in users can see every event and their own check-in...
create table public.events ( id bigint primary key, name text not null, starts_at timestamptz not null, ends_at timestamptz not null ); create table public.checkins ( event_id bigint not null references public.events(id), user_id uuid not null default auth.uid() references auth.users(id), checked_in_at t...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.events (id, name, starts_at, ends_at) values (1, 'Always-on conference', '2020-01-01', '2099-01-01'), (2, 'Launch party', '2020-...
- name: user_sees_events covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select count(*) from events expect: rows: - [3] - name: user_sees_own_checkins covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select event_id fro...
12
alter table public.events enable row level security; alter table public.checkins enable row level security; revoke insert, update on public.checkins from anon, authenticated; grant insert (event_id, user_id) on public.checkins to authenticated; create policy events_select on public.events for select to authenticate...
[ { "name": "old-vs-new", "sql": "alter table public.events enable row level security;\nalter table public.checkins enable row level security;\n\ncreate policy events_select on public.events\n for select to authenticated\n using (true);\n\ncreate policy checkins_select on public.checkins\n for select to au...
T087
Garage repair jobs: mechanics quote, customers approve
2
train
[ "two-roles", "state-transition", "old-vs-new", "client-returning" ]
[ "self-approval", "privilege-escalation", "state-transition" ]
[]
[ "garage 1 mechanic mo (…01); garage 2 mechanic ned (…02); customers cal (…03) and dee (…04)", "job 1 (garage 1, cal) quoted ₹4500; job 2 (garage 1, dee) approved; job 3 (garage 2, cal) in progress" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A garage app built with supabase-js. Mechanics open jobs with `supabase.from('jobs').insert({...}).select()` and update them with `.update({...}).eq('id', id).select()`. Customers approve a quote with `.update({ status: 'approved', quote_amount }).eq('id', id).select()`, sending back the amount they saw. Jobs move `quo...
create table public.garages ( id bigint primary key, name text not null ); create table public.mechanics ( garage_id bigint not null references public.garages(id), user_id uuid not null references auth.users(id), primary key (garage_id, user_id) ); create table public.jobs ( id bigint generated by default...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'mo@example.com'), ('00000000-0000-0000-0000-000000000002', 'ned@example.com'), ('00000000-0000-0000-0000-000000000003', 'cal@example.com'), ('00000000-0000-0000-0000-000000000004', 'dee@example.com'); insert into public.garages...
- name: customer_sees_own_jobs covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select id from jobs order by id expect: rows: - [1] - [3] - name: mechanic_sees_garage_jobs covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} s...
18
create schema private; grant usage on schema private to authenticated; create function private.is_mechanic(p_garage_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.mechanics m where m.garage_id = p_garage_id and m.user_id = auth.uid()) $...
[ { "name": "privilege-escalation", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_mechanic(p_garage_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.mechanics m ...
T088
Co-working desk bookings limited by tier, membership and a booking cap
2
train
[ "aggregate-limit", "time-window", "reference-check", "membership-tier" ]
[ "reference-check", "aggregate-limit", "time-window" ]
[]
[ "pia (…01) premium, already holds 3 upcoming bookings (the cap); sam (…02) standard; exp (…03) standard membership ended 2020; pre (…04) premium with no bookings", "desk 1 standard, desk 2 premium; sam has one past booking (2020) and one upcoming" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A co-working space app built with supabase-js. Members book a desk for a day with `supabase.from('bookings').insert({ desk_id, day, user_id }).select()` and cancel with `.delete()`; the primary key prevents double bookings. Dates are compared with `current_date`. R1. Signed-in users can see every desk and every bookin...
create table public.desks ( id bigint primary key, label text not null, zone text not null check (zone in ('standard', 'premium')) ); create table public.memberships ( user_id uuid primary key references auth.users(id), tier text not null check (tier in ('standard', 'premium')), valid_until date not null )...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'pia@example.com'), ('00000000-0000-0000-0000-000000000002', 'sam@example.com'), ('00000000-0000-0000-0000-000000000003', 'exp@example.com'), ('00000000-0000-0000-0000-000000000004', 'pre@example.com'); insert into public.desks ...
- name: user_sees_all_bookings covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select count(*) from bookings expect: rows: - [5] - name: user_sees_own_membership covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select ti...
18
create schema private; grant usage on schema private to authenticated; create function private.membership_ok(p_desk_id bigint, p_day date) returns boolean language sql stable security definer set search_path = '' as $$ select exists ( select 1 from public.memberships m join public.desks d on d.id = p_desk_id ...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.membership_ok(p_desk_id bigint, p_day date) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (\n select 1 from public...
T089
Newsroom articles moving from draft to review to published
2
train
[ "workflow", "state-transition", "editor-role", "anon-read", "client-returning" ]
[ "state-transition", "private-row-leak", "negative-condition" ]
[]
[ "writers wen (…01) and wes (…02); editor ed (…03)", "wen: draft 1, in-review 2; wes: published 3, draft 4" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A newsroom tool built with supabase-js. Writers create drafts with `supabase.from('articles').insert({...}).select()`, edit them, and submit them with `.update({ status: 'in_review' }).eq('id', id).select()`. Editors (users in `editors`) publish with `.update({ status: 'published', published_at }).eq('id', id).select()...
create table public.editors ( user_id uuid primary key references auth.users(id) ); create table public.articles ( id bigint generated by default as identity primary key, author_id uuid not null default auth.uid() references auth.users(id), title text not null, body text not null default '', status text no...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'wen@example.com'), ('00000000-0000-0000-0000-000000000002', 'wes@example.com'), ('00000000-0000-0000-0000-000000000003', 'ed@example.com'); insert into public.editors (user_id) values ('00000000-0000-0000-0000-000000000003'); in...
- name: anon_reads_published_articles covers: [R1] as: {role: anon} sql: select id from articles order by id expect: rows: - [3] - name: writer_reads_own_and_published covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from articles order by id expe...
18
create schema private; grant usage on schema private to anon, authenticated; create function private.is_editor() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.editors e where e.user_id = auth.uid()) $$; alter table public.editors enable row leve...
[ { "name": "negative-condition", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.is_editor() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.editors e where e.user_id = ...
T091
Household shopping list where members claim and buy items
2
train
[ "membership", "claim-a-row", "column-restriction", "client-returning" ]
[ "state-transition", "weak-with-check", "reference-check" ]
[]
[ "household 1: ana (…01), ben (…02); household 2: cy (…03)", "items: 1 Milk (added by ana, unclaimed), 2 Eggs (claimed by ben), 3 Rice (claimed and bought by ana), 4 Tea (household 2)" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A household shopping-list app built with supabase-js. Members add items with `supabase.from('shopping_items').insert({ household_id, name, added_by }).select()`. They claim an item ("I'll buy it") with `.update({ claimed_by: userId })`, unclaim with `.update({ claimed_by: null })` and tick it off with `.update({ is_bou...
create table public.household_members ( household_id bigint not null, user_id uuid not null references auth.users(id), primary key (household_id, user_id) ); create table public.shopping_items ( id bigint generated by default as identity primary key, household_id bigint not null, name text not null, adde...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'), ('00000000-0000-0000-0000-000000000003', 'cy@example.com'); insert into public.household_members (household_id, user_id) values (1, '00000000-0000-00...
- name: member_sees_household_items covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from shopping_items order by id expect: rows: - [1] - [2] - [3] - name: other_household_sees_only_own covers: [R1] as: {role: authenticated, sub: 00000000-000...
20
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_household_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.household_members m where m.household_id = p_household_id and m.user_id ...
[ { "name": "reference-check", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_household_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.household_member...
T092
Referral codes redeemed through an RPC with fraud limits
3
train
[ "rpc", "security-definer", "fraud-limits", "aggregate-limit", "read-only-tables" ]
[ "self-approval", "duplicate-approval", "aggregate-limit" ]
[]
[ "ana (…01) owns code REF-ANA and referred old (…09); max (…02) owns code MAXED and already referred five users (…03–…07)", "newbie (…08) has never been referred; r1 (…03) owns code REF-R1 with no referrals yet", "referrals has no unique constraint on referee_id, so the function must enforce one redemption per u...
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A fintech app built with supabase-js. Each user has a referral code created by the server. A new user enters a friend's code with `supabase.rpc('redeem_referral', { p_code })`. Implement it as `public.redeem_referral(p_code text) returns bigint`, returning the new referral's id. Each successful redemption gives 100 cre...
create table public.referral_codes ( code text primary key, user_id uuid not null unique references auth.users(id) ); create table public.referrals ( id bigint generated by default as identity primary key, referrer_id uuid not null references auth.users(id), referee_id uuid not null references auth.users(id)...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'max@example.com'), ('00000000-0000-0000-0000-000000000003', 'r1@example.com'), ('00000000-0000-0000-0000-000000000004', 'r2@example.com'), ('00000000-0000-0000-0000-...
- name: user_sees_own_code covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select code from referral_codes expect: rows: - [REF-ANA] - name: referrer_sees_own_referrals covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: se...
15
alter table public.referral_codes enable row level security; alter table public.referrals enable row level security; alter table public.credits enable row level security; create policy referral_codes_select on public.referral_codes for select to authenticated using (user_id = auth.uid()); create policy referrals_...
[ { "name": "aggregate-limit", "sql": "alter table public.referral_codes enable row level security;\nalter table public.referrals enable row level security;\nalter table public.credits enable row level security;\n\ncreate policy referral_codes_select on public.referral_codes\n for select to authenticated\n ...
T093
Audit trail written by a trigger, plus an admin-only restore RPC
3
train
[ "trigger", "audit-log", "soft-delete", "rpc", "time-window" ]
[ "audit-forgery", "missing-audit", "time-window", "rpc-missing-auth-check" ]
[]
[ "org 1: admin adm (…01), member mem (…02); org 2: admin oz (…03)", "record 3 (org 1) was soft-deleted in 2020, too long ago to restore; record 4 belongs to org 2", "two seeded audit rows for org 1 records and one for record 4" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A compliance-minded records app built with supabase-js. Records are created and edited with `.insert({...}).select()` and `.update({...}).eq('id', id).select()`; admins delete a record by setting `deleted_at`. Admins can undo a deletion with `supabase.rpc('restore_record', { p_record_id })`, implemented as `public.rest...
create table public.org_members ( org_id bigint not null, user_id uuid not null references auth.users(id), role text not null check (role in ('admin', 'member')), primary key (org_id, user_id) ); create table public.records ( id bigint generated by default as identity primary key, org_id bigint not null, ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'adm@example.com'), ('00000000-0000-0000-0000-000000000002', 'mem@example.com'), ('00000000-0000-0000-0000-000000000003', 'oz@example.com'); insert into public.org_members (org_id, user_id, role) values (1, '00000000-0000-0000-000...
- name: member_sees_live_records covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select id from records order by id expect: rows: - [1] - [2] - name: admin_also_sees_deleted_records covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000...
23
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_org_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.org_members m where m.org_id = p_org_id and m.user_id = auth.uid()) $$; creat...
[ { "name": "audit-forgery", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_org_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.org_members m where m.or...
T094
Habits that users archive and restore instead of deleting
1
train
[ "single-owner", "soft-delete", "client-filtering" ]
[ "soft-delete-visibility", "private-row-leak" ]
[]
[ "ana (…01): active habit 1 and archived habit 2; ben (…02): habit 3" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A habit tracker built with supabase-js. The main list loads `supabase.from('habits').select().is('archived_at', null)` and the archive page loads the rest. Users archive a habit with `.update({ archived_at })` and restore it with `.update({ archived_at: null })`, each `.eq('id', id)`. R1. Users can see all of their ow...
create table public.habits ( id bigint generated by default as identity primary key, user_id uuid not null default auth.uid() references auth.users(id), name text not null, archived_at timestamptz );
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into public.habits (id, user_id, name, archived_at) values (1, '00000000-0000-0000-0000-000000000001', 'Drink 2L water', null), (2, '0000000...
- name: user_sees_active_and_archived_habits covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from habits order by id expect: rows: - [1] - [2] - name: user_cannot_see_someone_elses_habits covers: [R1] as: {role: authenticated, sub: 00000000-0000-...
12
alter table public.habits enable row level security; create policy habits_select on public.habits for select to authenticated using (user_id = auth.uid()); create policy habits_insert on public.habits for insert to authenticated with check (user_id = auth.uid()); create policy habits_update on public.habits ...
[ { "name": "private-row-leak", "sql": "alter table public.habits enable row level security;\n\ncreate policy habits_select on public.habits\n for select to authenticated\n using (true);\n\ncreate policy habits_insert on public.habits\n for insert to authenticated\n with check (user_id = auth.uid());\n\nc...
T096
Private invoice PDFs stored in each user's own folder
1
train
[ "storage-paths", "single-owner", "file-type" ]
[ "owner-column-trust", "file-type-check" ]
[ "storage.objects" ]
[ "ana's (…01) and ben's (…02) invoices in their folders", "an object outside any user folder: 'misc/readme.txt'" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A billing app built with supabase-js and Supabase Storage. Each user's invoices live in the private bucket `invoices` under `<user id>/<file>.pdf`. The app uploads with `supabase.storage.from('invoices').upload(path, file)`, which inserts the object row with `owner` set to the uploader. Uploads, renames and moves read ...
-- This task uses Supabase Storage only: storage.buckets and storage.objects already exist.
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ana@example.com'), ('00000000-0000-0000-0000-000000000002', 'ben@example.com'); insert into storage.buckets (id, name, public) values ('invoices', 'invoices', false); insert into storage.objects (bucket_id, name, owner) values (...
- name: user_reads_own_invoices covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select name from storage.objects where bucket_id = 'invoices' order by name expect: rows: - [00000000-0000-0000-0000-000000000001/2020-01.pdf] - name: user_cannot_read_someone_elses_in...
13
create policy invoices_select on storage.objects for select to authenticated using (bucket_id = 'invoices' and (storage.foldername(name))[1] = auth.uid()::text); create policy invoices_insert on storage.objects for insert to authenticated with check (bucket_id = 'invoices' and (storage.foldername(name))[1] = a...
[ { "name": "file-type-check", "sql": "create policy invoices_select on storage.objects\n for select to authenticated\n using (bucket_id = 'invoices' and (storage.foldername(name))[1] = auth.uid()::text);\n\ncreate policy invoices_insert on storage.objects\n for insert to authenticated\n with check (bucke...
T100
Tutoring messages allowed only on confirmed bookings
2
train
[ "parent-child", "negative-condition", "participants", "client-returning" ]
[ "negative-condition", "reference-check", "child-leak" ]
[]
[ "booking 1 (stu1 …01 with tutor tut1 …03) confirmed; booking 2 (stu2 …02 with tut1) cancelled; booking 3 (stu1 with tut1) still requested" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A tutoring marketplace built with supabase-js. Bookings between a student and a tutor are created and confirmed by the server. The booking page sends messages with `supabase.from('booking_messages').insert({ booking_id, sender_id, body }).select()`. R1. Students and tutors can see their own bookings and every message ...
create table public.bookings ( id bigint primary key, student_id uuid not null references auth.users(id), tutor_id uuid not null references auth.users(id), status text not null check (status in ('requested', 'confirmed', 'cancelled')) ); create table public.booking_messages ( id bigint generated by default a...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'stu1@example.com'), ('00000000-0000-0000-0000-000000000002', 'stu2@example.com'), ('00000000-0000-0000-0000-000000000003', 'tut1@example.com'); insert into public.bookings (id, student_id, tutor_id, status) values (1, '00000000...
- name: student_sees_own_booking_messages covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from booking_messages order by id expect: rows: - [1] - [2] - name: other_student_sees_only_own covers: [R1] as: {role: authenticated, sub: 00000000-0000-00...
16
create schema private; grant usage on schema private to authenticated; create function private.in_booking(p_booking_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.bookings b where b.id = p_booking_id and (b.student_id = auth.uid() or b....
[ { "name": "child-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.in_booking(p_booking_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.bookings b where b.id ...
T101
Break-glass emergency access to medical records
3
train
[ "rpc", "security-definer", "time-window", "audit", "input-validation" ]
[ "time-window", "rpc-input-validation", "rpc-missing-auth-check" ]
[]
[ "clinician doc1 (…01) is in patient 1's care team; clinician doc2 (…02) has an expired 2020 grant for patient 2", "auditor aud (…03) is not a clinician" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A hospital records system built with supabase-js. Clinicians normally see only their care-team patients. In an emergency a clinician can "break the glass" with `supabase.rpc('break_glass', { p_patient_id, p_reason })`, implemented as `public.break_glass(p_patient_id bigint, p_reason text) returns timestamptz`, which gr...
create table public.clinicians ( user_id uuid primary key references auth.users(id) ); create table public.auditors ( user_id uuid primary key references auth.users(id) ); create table public.patients ( id bigint primary key, name text not null ); create table public.care_team ( patient_id bigint not null ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'doc1@example.com'), ('00000000-0000-0000-0000-000000000002', 'doc2@example.com'), ('00000000-0000-0000-0000-000000000003', 'aud@example.com'); insert into public.clinicians (user_id) values ('00000000-0000-0000-0000-000000000001'...
- name: care_team_clinician_reads_records covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from medical_records order by id expect: rows: - [1] - name: expired_grant_gives_no_access covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-0...
17
create schema private; grant usage on schema private to authenticated; create function private.is_clinician() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.clinicians c where c.user_id = auth.uid()) $$; create function private.is_auditor() retur...
[ { "name": "rpc-input-validation", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_clinician() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.clinicians c where c.user_id ...
T102
Stock transfers between warehouses through a checked RPC
3
train
[ "rpc", "security-definer", "input-validation", "staff-role", "read-only-tables" ]
[ "overdraft", "rpc-input-validation", "reference-check" ]
[]
[ "warehouse 1 (staff sam …01) holds 10 × SKU-1; warehouse 2 (staff sue …02) holds 3; warehouse 3 has no stock row yet", "stock has no check constraint on qty, so the function must refuse overdrafts itself" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A warehouse app built with supabase-js. Staff move stock with `supabase.rpc('transfer_stock', { p_from, p_to, p_sku, p_qty })`, implemented as `public.transfer_stock(p_from bigint, p_to bigint, p_sku text, p_qty integer) returns integer`, which returns the quantity left at the source. R1. Signed-in users can see the l...
create table public.warehouses ( id bigint primary key, name text not null ); create table public.warehouse_staff ( warehouse_id bigint not null references public.warehouses(id), user_id uuid not null references auth.users(id), primary key (warehouse_id, user_id) ); create table public.stock ( warehouse_i...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'sam@example.com'), ('00000000-0000-0000-0000-000000000002', 'sue@example.com'); insert into public.warehouses (id, name) values (1, 'Pune'), (2, 'Mumbai'), (3, 'Nagpur'); insert into public.warehouse_staff (warehouse_id, user_id) ...
- name: staff_sees_own_warehouse_stock covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select warehouse_id, sku, qty from stock order by warehouse_id expect: rows: - [1, SKU-1, 10] - name: other_staff_sees_only_own_warehouse covers: [R1] as: {role: authenticat...
17
create schema private; grant usage on schema private to authenticated; create function private.is_staff(p_warehouse_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.warehouse_staff s where s.warehouse_id = p_warehouse_id and s.user_id = a...
[ { "name": "overdraft", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_staff(p_warehouse_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.warehouse_staff s where...
T103
Role-management RPC and an internal function only the server may call
3
train
[ "rpc", "security-definer", "function-privileges", "role-management" ]
[ "rpc-exposed", "rpc-missing-auth-check", "self-approval" ]
[]
[ "org 1: owner own (…01), admin adm (…02), member mem (…03); org 2: admin oz (…04) and member zed (…05)", "the shim's default privileges let anon and authenticated execute new public functions unless revoked" ]
2026-10-25T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A team app built with supabase-js. Admins change roles with `supabase.rpc('set_member_role', { p_org_id, p_user_id, p_role })`, implemented as `public.set_member_role(p_org_id bigint, p_user_id uuid, p_role text) returns text` (returning the new role). A nightly server job calls `public.recalculate_leaderboard() return...
create table public.org_members ( org_id bigint not null, user_id uuid not null references auth.users(id), role text not null check (role in ('owner', 'admin', 'member')), primary key (org_id, user_id) ); create table public.leaderboard ( user_id uuid primary key references auth.users(id), score integer no...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'own@example.com'), ('00000000-0000-0000-0000-000000000002', 'adm@example.com'), ('00000000-0000-0000-0000-000000000003', 'mem@example.com'), ('00000000-0000-0000-0000-000000000004', 'oz@example.com'), ('00000000-0000-0000-0000...
- name: member_sees_org_memberships covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from org_members expect: rows: - [3] - name: user_sees_leaderboard covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000005} sql: sele...
18
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_org_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.org_members m where m.org_id = p_org_id and m.user_id = auth.uid()) $$; alter...
[ { "name": "rpc-exposed", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_org_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.org_members m where m.org_...
T104
Volunteer shift sign-ups with capacity and coordinators
2
train
[ "aggregate-limit", "time-window", "two-roles", "column-restriction", "client-returning" ]
[ "aggregate-limit", "time-window", "privilege-escalation" ]
[]
[ "volunteers vol1 (…01), vol2 (…02); coordinator coord (…03)", "shift 1 open in 2099, capacity 2, one active sign-up (vol2); shift 2 open in 2099, capacity 1, full (vol1)", "shift 3 cancelled; shift 4 open but in 2020; vol1 has a cancelled sign-up on shift 4" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A volunteer scheduling app built with supabase-js. Coordinators are the users listed in `coordinators`. Volunteers sign up with `supabase.from('signups').insert({ shift_id, volunteer_id }).select()` and cancel with `supabase.from('signups').update({ status: 'cancelled' }).eq('id', id).select()`. R1. Signed-in users ca...
create table public.coordinators ( user_id uuid primary key references auth.users(id) ); create table public.shifts ( id bigint generated by default as identity primary key, title text not null, starts_at timestamptz not null, capacity integer not null check (capacity > 0), status text not null default 'op...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'vol1@example.com'), ('00000000-0000-0000-0000-000000000002', 'vol2@example.com'), ('00000000-0000-0000-0000-000000000003', 'coord@example.com'); insert into public.coordinators (user_id) values ('00000000-0000-0000-0000-000000000...
- name: volunteer_sees_open_shifts covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from shifts order by id expect: rows: - [1] - [2] - [4] - name: coordinator_sees_cancelled_shift_too covers: [R1] as: {role: authenticated, sub: 00000000-0000-...
23
create schema private; grant usage on schema private to authenticated; create function private.is_coordinator() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.coordinators c where c.user_id = auth.uid()) $$; create function private.shift_open_fut...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_coordinator() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.coordinators c where c.user_id =...
T105
Podcast episodes that go public at their publish time
2
train
[ "anon-read", "publish-window", "parent-child", "role-by-table", "client-returning" ]
[ "private-row-leak", "time-window", "reference-check" ]
[]
[ "hosts h1 (…01, show 1) and h2 (…02, show 2); listener (…03) hosts nothing", "show 1: episode 1 published in 2020, episode 2 published but dated 2099, episode 3 draft", "show 2: episode 4 published in 2020, episode 5 a draft with a tentative 2020 date" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A podcast site built with supabase-js. Shows and their hosts (`hosts`) are set up by server-side code. Hosts manage episodes with `supabase.from('episodes').insert({...}).select()` and `.update({...}).eq('id', id).select()`. Visitors, signed in or not, browse the site. R1. Anyone, including anonymous visitors, can rea...
create table public.shows ( id bigint generated by default as identity primary key, title text not null ); create table public.hosts ( show_id bigint not null references public.shows(id), user_id uuid not null references auth.users(id), primary key (show_id, user_id) ); create table public.episodes ( id b...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'h1@example.com'), ('00000000-0000-0000-0000-000000000002', 'h2@example.com'), ('00000000-0000-0000-0000-000000000003', 'listener@example.com'); insert into public.shows (id, title) values (1, 'Database Hour'), (2, 'Ship It'); in...
- name: anon_reads_published_episodes covers: [R1] as: {role: anon} sql: select id from episodes order by id expect: rows: - [1] - [4] - name: anon_cannot_see_future_dated_episode covers: [R1] as: {role: anon} sql: select id from episodes where id = 2 expect: {denied: true} - name: anon_re...
20
create schema private; grant usage on schema private to anon, authenticated; create function private.is_host(p_show_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.hosts h where h.show_id = p_show_id and h.user_id = auth.uid()) $$; alte...
[ { "name": "private-row-leak", "sql": "create schema private;\n\ngrant usage on schema private to anon, authenticated;\n\ncreate function private.is_host(p_show_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.hosts h where h....
T106
Bike-share rentals: one open rental per rider, cost set by the server
2
train
[ "aggregate-limit", "reference-check", "column-restriction", "state-transition", "client-returning" ]
[ "aggregate-limit", "reference-check", "privilege-escalation" ]
[]
[ "riders u1 (…01), u2 (…02); staff member staff (…03)", "bike 1 in service and free; bike 2 in service but rented by u2 (open rental 1); bike 3 out of service", "u1 has a returned rental (2) with a cost" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A bike-share app built with supabase-js. Riders start a rental with `supabase.from('rentals').insert({ bike_id, user_id }).select()` and end it with `supabase.from('rentals').update({ returned_at }).eq('id', id).select()`. A server job computes `cost_cents` after the return. Staff are the users in `staff`. R1. Signed-...
create table public.staff ( user_id uuid primary key references auth.users(id) ); create table public.bikes ( id bigint generated by default as identity primary key, label text not null, status text not null default 'in_service' check (status in ('in_service', 'out_of_service')) ); create table public.rentals...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'u1@example.com'), ('00000000-0000-0000-0000-000000000002', 'u2@example.com'), ('00000000-0000-0000-0000-000000000003', 'staff@example.com'); insert into public.staff (user_id) values ('00000000-0000-0000-0000-000000000003'); ins...
- name: user_sees_bikes covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from bikes order by id expect: rows: - [1] - [2] - [3] - name: user_sees_own_rentals covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} s...
20
create schema private; grant usage on schema private to authenticated; create function private.is_staff() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.staff s where s.user_id = auth.uid()) $$; create function private.bike_free(p_bike_id bigint)...
[ { "name": "aggregate-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_staff() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.staff s where s.user_id = auth.uid())\...
T107
Bug bounties awarded to exactly one submission
2
train
[ "state-transition", "duplicate-approval", "private-rows", "reference-check", "client-returning" ]
[ "duplicate-approval", "state-transition", "private-row-leak" ]
[]
[ "poster p1 (…01); submitters s1 (…02), s2 (…03), s3 (…04), s4 (…05, no submissions)", "bounty 1 open (p1): submissions 1 (s1), 2 (s2); bounty 2 awarded (p1) to submission 3 (s1), also has submission 5 (s3)", "bounty 3 open, posted by s2: submission 4 (s1)" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A bug-bounty board built with supabase-js. Users post bounties with `supabase.from('bounties').insert({...}).select()`, submit findings with `supabase.from('submissions').insert({ bounty_id, submitter_id, body }).select()`, and the poster awards a bounty with `supabase.from('bounties').update({ status: 'awarded', award...
create table public.bounties ( id bigint generated by default as identity primary key, title text not null, poster_id uuid not null default auth.uid() references auth.users(id), status text not null default 'open' check (status in ('open', 'awarded')), awarded_submission_id bigint ); create table public.subm...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'p1@example.com'), ('00000000-0000-0000-0000-000000000002', 's1@example.com'), ('00000000-0000-0000-0000-000000000003', 's2@example.com'), ('00000000-0000-0000-0000-000000000004', 's3@example.com'), ('00000000-0000-0000-0000-00...
- name: user_reads_bounties covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} sql: select count(*) from bounties expect: rows: - [3] - name: user_posts_bounty covers: [R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} client: op: insert ...
24
create schema private; grant usage on schema private to authenticated; create function private.bounty_poster(p_bounty_id bigint) returns uuid language sql stable security definer set search_path = '' as $$ select b.poster_id from public.bounties b where b.id = p_bounty_id $$; create function private.bounty_open(p_...
[ { "name": "duplicate-approval", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.bounty_poster(p_bounty_id bigint) returns uuid\nlanguage sql stable security definer set search_path = ''\nas $$\n select b.poster_id from public.bounties b where b.i...
T108
Donation campaigns where anonymous donors stay hidden from the organiser
2
train
[ "view", "column-masking", "owner-rights-view", "reference-check", "client-returning" ]
[ "view-bypass", "column-leak", "reference-check" ]
[]
[ "organiser o1 (…01) owns campaign 1 (active) and 2 (closed); donor d1 (…02) owns campaign 3 (active); donor d2 (…03)", "donations: 1 d1→c1 public; 2 d2→c1 anonymous; 3 d2→c2 public; 4 d2→c3 anonymous" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A fundraising app built with supabase-js. Donors give with `supabase.from('donations').insert({ campaign_id, donor_id, amount_cents, anonymous, message }).select()`. Organisers read the donations to their campaigns from the view `campaign_donations` (columns `id, campaign_id, amount_cents, message, anonymous, donor_id`...
create table public.campaigns ( id bigint generated by default as identity primary key, title text not null, owner_id uuid not null default auth.uid() references auth.users(id), status text not null default 'active' check (status in ('active', 'closed')) ); create table public.donations ( id bigint generated...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'o1@example.com'), ('00000000-0000-0000-0000-000000000002', 'd1@example.com'), ('00000000-0000-0000-0000-000000000003', 'd2@example.com'); insert into public.campaigns (id, title, owner_id, status) values (1, 'New roof for the s...
- name: user_reads_campaigns covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} sql: select count(*) from campaigns expect: rows: - [3] - name: user_creates_campaign covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000003} client: op: in...
20
create schema private; grant usage on schema private to authenticated; create function private.campaign_active(p_campaign_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.campaigns c where c.id = p_campaign_id and c.status = 'active') $$;...
[ { "name": "column-leak", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.campaign_active(p_campaign_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.campaigns c whe...
T109
Wiki pages edited only under a short-lived lock
2
train
[ "lock-bypass", "time-window", "membership", "column-restriction" ]
[ "lock-bypass", "time-window", "privilege-escalation" ]
[]
[ "space 1: members m1 (…01) and m2 (…02); space 2: member m2 only; outsider (…03) is in no space", "page 1 (space 1) unlocked; page 2 (space 1) locked by m2 until 2099; page 3 (space 1) locked by m2 until 2020 (expired); page 4 (space 2) unlocked" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A team wiki. Spaces and memberships are managed by server-side code. To edit a page, the app first takes a lock by updating `locked_by` to the user and `locked_until` to a time at most 30 minutes ahead, and then saves `title` and `body`; taking the lock and saving can happen in one update. Locks are not released by han...
create table public.spaces ( id bigint generated by default as identity primary key, name text not null ); create table public.members ( space_id bigint not null references public.spaces(id), user_id uuid not null references auth.users(id), primary key (space_id, user_id) ); create table public.pages ( id...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'm1@example.com'), ('00000000-0000-0000-0000-000000000002', 'm2@example.com'), ('00000000-0000-0000-0000-000000000003', 'outsider@example.com'); insert into public.spaces (id, name) values (1, 'Engineering'), (2, 'Design'); inser...
- name: member_reads_space_pages covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from pages order by id expect: rows: - [1] - [2] - [3] - name: member_reads_space_row covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-0000000...
23
create schema private; grant usage on schema private to authenticated; create function private.is_member(p_space_id bigint) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.members m where m.space_id = p_space_id and m.user_id = auth.uid()) $$; alt...
[ { "name": "lock-bypass", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_member(p_space_id bigint) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.members m where m.space_...
T110
Seat holds and bookings that only happen through two RPCs
3
train
[ "rpc", "security-definer", "time-window", "column-masking", "view", "sequencing" ]
[ "rpc-missing-auth-check", "sequence-bypass", "time-window", "column-leak" ]
[]
[ "users u1 (…01), u2 (…02)", "event 1 seats: 1 free; 2 held by u2 until 2099 (live); 3 held by u2 until 2020 (expired); 4 booked by u2; 5 free; 6 held by u1 until 2020 (expired)" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A ticketing app. The seat map is read from the view `seat_map` (columns `id, event_id, label, status`), which must exist with that name. Seats are held and booked only through two RPCs that must exist: `hold_seat(p_seat_id bigint)` and `confirm_seat(p_seat_id bigint)`, both returning void and raising an error when the ...
create table public.events ( id bigint generated by default as identity primary key, name text not null ); create table public.seats ( id bigint generated by default as identity primary key, event_id bigint not null references public.events(id), label text not null, status text not null default 'free' chec...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'u1@example.com'), ('00000000-0000-0000-0000-000000000002', 'u2@example.com'); insert into public.events (id, name) values (1, 'Spring recital'); insert into public.seats (id, event_id, label, status, holder_id, hold_until, booked_...
- name: user_reads_seat_map covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id, status from seat_map where event_id = 1 order by id expect: rows: - [1, free] - [2, held] - [3, free] - [4, booked] - [5, free] - [6, free] - name: user_read...
20
alter table public.events enable row level security; alter table public.seats enable row level security; create policy events_select on public.events for select to authenticated using (true); create policy seats_select_own on public.seats for select to authenticated using (holder_id = auth.uid() or booked_by ...
[ { "name": "column-leak", "sql": "alter table public.events enable row level security;\nalter table public.seats enable row level security;\n\ncreate policy events_select on public.events\n for select to authenticated\n using (true);\n\ncreate policy seats_select_own on public.seats\n for select to authen...
T111
Payroll adjustments approved by the direct manager up to a limit, by finance above it
3
train
[ "approval-limit", "hierarchy", "self-approval", "state-transition", "column-restriction", "client-returning" ]
[ "approval-limit", "self-approval", "skip-level-access", "state-transition" ]
[]
[ "ceo (…01) manages mgr (…02) and fin (…03, finance); mgr manages emp (…04) and emp2 (…05)", "adjustments: 1 emp 20,000 pending; 2 emp2 90,000 pending; 3 emp 10,000 approved by mgr; 4 mgr 30,000 pending; 5 fin 5,000 pending" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
An HR tool built with supabase-js. `employees` holds each person's direct manager and whether they are in finance. Managers raise adjustments with `supabase.from('adjustments').insert({ employee_id, amount_cents, reason, created_by }).select()` and decide them with `supabase.from('adjustments').update({ status, approve...
create table public.employees ( user_id uuid primary key references auth.users(id), manager_id uuid references auth.users(id), is_finance boolean not null default false ); create table public.adjustments ( id bigint generated by default as identity primary key, employee_id uuid not null references auth.users...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ceo@example.com'), ('00000000-0000-0000-0000-000000000002', 'mgr@example.com'), ('00000000-0000-0000-0000-000000000003', 'fin@example.com'), ('00000000-0000-0000-0000-000000000004', 'emp@example.com'), ('00000000-0000-0000-000...
- name: employee_sees_own_adjustments covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000004} sql: select id from adjustments order by id expect: rows: - [1] - [3] - name: manager_sees_direct_reports_adjustments covers: [R1] as: {role: authenticated, sub: 00000000-0000...
24
create schema private; grant usage on schema private to authenticated; create function private.is_finance() returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.employees e where e.user_id = auth.uid() and e.is_finance) $$; create function private.mana...
[ { "name": "approval-limit", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.is_finance() returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.employees e where e.user_id = auth.ui...
T112
Course materials bucket: instructors upload PDFs and videos, enrolled students read
3
train
[ "storage-paths", "file-type", "enrollment", "bucket-scope", "owner-column-trust" ]
[ "file-type-check", "bucket-scope", "storage-path", "owner-column-trust" ]
[ "storage.objects" ]
[ "instructors ins1 (…01, course 1) and ins2 (…02, course 2); stu (…03) is enrolled in course 1; other (…04) is in no course", "bucket materials (private): 1/intro.pdf, 1/lecture.mp4, 2/notes.pdf; bucket avatars (public): x.png" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A course site using Supabase Storage. Files live in the private bucket `materials` under a folder named after the course id (`<course_id>/<file>`). Instructors upload from the app with the storage client, which inserts `storage.objects` rows with `owner` set to the uploading user. The bucket `avatars` belongs to anothe...
create table public.courses ( id bigint generated by default as identity primary key, title text not null, instructor_id uuid not null references auth.users(id) ); create table public.enrollments ( course_id bigint not null references public.courses(id), student_id uuid not null references auth.users(id), ...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'ins1@example.com'), ('00000000-0000-0000-0000-000000000002', 'ins2@example.com'), ('00000000-0000-0000-0000-000000000003', 'stu@example.com'), ('00000000-0000-0000-0000-000000000004', 'other@example.com'); insert into public.co...
- name: instructor_lists_own_course_files covers: [R1, R2] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select name from storage.objects where bucket_id = 'materials' order by name expect: rows: - [1/intro.pdf] - [1/lecture.mp4] - name: student_reads_enrolled_course_fil...
22
create schema private; grant usage on schema private to authenticated; create function private.teaches_folder(p_folder text) returns boolean language sql stable security definer set search_path = '' as $$ select exists (select 1 from public.courses c where c.id::text = p_folder and c.instructor_id = auth.uid()) $$;...
[ { "name": "bucket-scope", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.teaches_folder(p_folder text) returns boolean\nlanguage sql stable security definer set search_path = ''\nas $$\n select exists (select 1 from public.courses c where c.id::...
T113
Home cameras shared with others, stream keys only in an MFA session
3
train
[ "mfa", "jwt-claims", "sharing", "expiry", "delegation", "client-returning" ]
[ "mfa-not-enforced", "time-window", "transitive-delegation" ]
[]
[ "own (…01) owns camera 1; g1 (…02) owns camera 2 and has a live share on camera 1 (until 2099); g2 (…03) has an expired share on camera 1 (2020); stranger (…04)", "stream_keys: camera 1 'k1', camera 2 'k2'" ]
2026-10-26T00:00:00
RLSBENCH-CANARY-f9002c750838f00b
A home-camera app built with supabase-js. Owners share a camera with `supabase.from('camera_shares').insert({ camera_id, grantee_id, expires_at, created_by }).select()`. Watching a stream needs the camera's row in `stream_keys`, which the app reads only after the user has completed multi-factor authentication; the sess...
create table public.cameras ( id bigint generated by default as identity primary key, owner_id uuid not null default auth.uid() references auth.users(id), label text not null ); create table public.camera_shares ( id bigint generated by default as identity primary key, camera_id bigint not null references pu...
insert into auth.users (id, email) values ('00000000-0000-0000-0000-000000000001', 'own@example.com'), ('00000000-0000-0000-0000-000000000002', 'g1@example.com'), ('00000000-0000-0000-0000-000000000003', 'g2@example.com'), ('00000000-0000-0000-0000-000000000004', 'stranger@example.com'); insert into public.cam...
- name: owner_sees_own_camera covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000001} sql: select id from cameras order by id expect: rows: - [1] - name: grantee_sees_shared_and_own_cameras covers: [R1] as: {role: authenticated, sub: 00000000-0000-0000-0000-000000000002} ...
25
create schema private; grant usage on schema private to authenticated; create function private.camera_owner(p_camera_id bigint) returns uuid language sql stable security definer set search_path = '' as $$ select c.owner_id from public.cameras c where c.id = p_camera_id $$; create function private.has_live_share(p_...
[ { "name": "mfa-not-enforced", "sql": "create schema private;\n\ngrant usage on schema private to authenticated;\n\ncreate function private.camera_owner(p_camera_id bigint) returns uuid\nlanguage sql stable security definer set search_path = ''\nas $$\n select c.owner_id from public.cameras c where c.id = p...