Datasets:
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... |
RLS-Bench
A verifiable benchmark for Supabase/Postgres Row Level Security policies. Each task gives a database schema and access rules written like a product spec. A model writes the policies, then executable tests run real queries as simulated users (anon, authenticated, service_role) and check exactly what each one can see and change. Besides pass/fail, every failure is classified as a leak (someone gets access they shouldn't) or a block (someone loses access they should have).
The harness, the baselines, the training code and every result are in the GitHub repo: github.com/devesh16145/rls-bench. This dataset is the task set from that repo; the adapters trained on it are at 9eve5h/rls-bench-adapters.
What is here
data/{train,dev,test}.jsonl: one row per task with the contents of every task file and its split. This is whatload_datasetreads.tasks/T###-title/: the task directories exactly as the harness reads them:schema.sql,seed.sql,requirement.md,tests.yaml,solution.sql,traps/*.sql,task.yaml.split.json: the frozen train/dev/test split with its seed, method and revision history.
Row fields
| Field | What |
|---|---|
id, title, tier |
task id (T001 …), title, difficulty tier 1–3 |
split |
train, dev or test |
tags, traps |
the task's tags and the names of the trap patterns it plants (docs/failure-taxonomy.md in the repo) |
requirement |
the numbered access rules (R1., R2., …) given to the model, with the canary string |
schema_sql, seed_sql |
the tables as the app already has them, and fixture rows including the edge cases the traps need |
tests_yaml, n_tests |
the tests: each runs a query as a specific user and states the rows, count, affected rows or denial it expects, citing the rules it covers |
solution_sql |
the reference policies |
trap_files |
{name, sql} for each planted wrong answer: realistic policies that pass most tests but open a hole |
extra_tables, fixture_notes, created, canary |
metadata from task.yaml |
Split
| Tier | Train | Dev | Test | Total |
|---|---|---|---|---|
| 1 | 22 | 3 | 6 | 31 |
| 2 | 38 | 5 | 9 | 52 |
| 3 | 22 | 3 | 5 | 30 |
| All | 82 | 11 | 20 | 113 |
Frozen on 2026-10-25 (seed 20261025; stratified by tier; per tier: test = round(20%), dev = round(10%), rest train; ids sorted then shuffled with random.Random(seed)). Revision on 2026-10-26: T104–T113 added to the train split (new tasks appended to train only; dev and test unchanged).
How a task is graded
A candidate's SQL is applied to the schema in a fresh database, then every test runs as its user with the Supabase JWT claims set the way Supabase sets them. A test passes if the observed rows, row count, affected count or denial matches expect. A failing test is a leak when the user saw or changed rows it should not have, and a block when it lost access it should have. A task passes only if every test passes.
A task was accepted into the set only if the reference solution passes; no-policy, allow-all and deny-all candidates fail; results are deterministic; every numbered rule is covered by a test; and every planted trap is caught by at least one test. Every task was then reviewed by hand against the checklist in the repo's docs/spec.md.
How models do
Leaderboard over the 103 original tasks (6 samples each, 95% intervals), from the repo's README; the ten tasks added to the train split on 2026-10-26 are not in these numbers.
| Model | Route | pass@1 | pass@5 | Leak rate | Tier 1 / 2 / 3 pass@1 |
|---|---|---|---|---|---|
| Claude Opus 5.5 (effort medium) | Anthropic API | 87% [79–92] | 92% | 1% | 97% / 100% / 54% |
| DeepSeek V4.1 Flash (16k reasoning) | OpenRouter | 55% [46–65] | 83% | 1% | 81% / 46% / 42% |
| Kimi K2.6 (reasoning off) | Tinker | 48% [39–58] | 72% | 16% | 68% / 37% / 42% |
| Qwen3.5-397B-A17B (reasoning off) | Tinker | 38% [29–48] | 48% | 15% | 55% / 28% / 35% |
| gpt-oss-120b (medium reasoning) | Tinker | 29% [21–38] | 37% | 10% | 58% / 15% / 19% |
| Nemotron-3.5-Lightning (16k reasoning) | OpenRouter | 18% [12–27] | 35% | 17% | 42% / 13% / 0% |
| Qwen3-14B (16k reasoning) | OpenRouter | 14% [8–22] | 25% | 17% | 35% / 4% / 4% |
| Nemotron-3.5-Lightning (reasoning off) | OpenRouter | 12% [7–19] | 20% | 25% | — |
| Qwen3.5-9B (reasoning off) | Tinker | 7% [3–13] | 7% | 25% | 13% / 2% / 8% |
The write-up in the repo (docs/writeup.md) covers the judge study (can an LLM grade policies by reading them? κ 0.72 for the best judge), and the training of Qwen3.5-9B and Nemotron-3.5-Lightning on the harness with LoRA SFT and GRPO.
Using it
from datasets import load_dataset
ds = load_dataset("9eve5h/rls-bench")
task = ds["test"][0]
print(task["requirement"])
print(task["schema_sql"])
Grading needs Postgres. Clone the repo, then:
uv sync
uv run rls db up # Docker if available, else embedded Postgres
uv run rls run tasks/T001-* my_policies.sql # per-test results for one candidate
uv run rls validate --all # the mutation checks on every task
The fixed prompt the baselines and the trained models saw is eval/prompts.py in the repo.
Canary
Every requirement ends with the string RLSBENCH-CANARY-f9002c750838f00b, which marks benchmark data. Please exclude documents containing it from training corpora, and check for it before reporting a model's score.
Limitations
- The schemas are synthetic and in a Supabase flavour; all tasks were written and reviewed by a single author.
- The dev and test splits are small (11 and 20 tasks), so intervals on them are wide.
- The reference solutions and traps are public here, as they are on GitHub.
License
CC-BY-4.0. The harness and the rest of the repo are MIT.
- Downloads last month
- 68