All rules Rule BV049
critical
hosted, paid — --remote

Row-level security disabled on an existing table

Critical — this fails outright or takes production down.

What it catches

DISABLE ROW LEVEL SECURITY switches off every policy on the table at once: from the moment it commits, queries see all rows, not the policy-filtered subset. If RLS was carrying tenant isolation or access control, this single line is a data exposure — and it looks like routine DDL.

Fires on

ALTER TABLE orders DISABLE ROW LEVEL SECURITY;

Do this instead

Change the policies, not the switch: adjust or replace the specific policy that is in the way, keeping enforcement on throughout. If RLS truly must go, that is a reviewed security decision with its own sign-off — not a line inside a schema migration.

-- Adjust the policy that's in the way; keep enforcement on:
SET lock_timeout = '5s';
DROP POLICY orders_tenant_read ON orders;
CREATE POLICY orders_tenant_read ON orders
  USING (tenant_id = current_setting('app.tenant_id')::bigint);
Catch this before it ships

This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql