severity: warnpack: dbv1.0 core
db/rls-permissive-using-true
RLS policy is `USING (true)`
npx @pitcheye/check . --pack dbwhyItBreaks
`USING (true)` is RLS switched on in name only: any authenticated (or anonymous, for SELECT grants) caller matches every row. It is usually added to silence a "new row violates row-level security policy" error, which means the write path is now open to the whole tenant population.
✖ Bad — triggers warnfixtures/db-rls-permissive-using-true/bad
CREATE POLICY "p" ON public.invoices FOR UPDATE USING (true);
✓ Good — passes checkfixtures/db-rls-permissive-using-true/good
CREATE POLICY "p" ON public.invoices FOR UPDATE USING (auth.uid()::text = owner_id);
suggestedFix
Scope the predicate to the owner, e.g. `USING (auth.uid()::text = user_id)` and the same expression for `WITH CHECK`.
explain_rule({"db/rls-permissive-using-true"})Agent & MCP JSON output contract
{
"ruleId": "db/rls-permissive-using-true",
"pack": "db",
"severity": "warn",
"file": "apps/web/src/app/api/health/route.ts",
"line": 6,
"message": "CREATE POLICY with FOR INSERT/UPDATE/DELETE/ALL and USING (true) or WITH CHECK (true)",
"whyItBreaks": "`USING (true)` is RLS switched on in name only: any authenticated (or anonymous, for SELECT grants) caller matches every row. It is usually added to silence a \"new row violates row-level security policy\" error, which means the write path is now open to the whole tenant population.",
"suggestedFix": "Scope the predicate to the owner, e.g. `USING (auth.uid()::text = user_id)` and the same expression for `WITH CHECK`.",
"docsUrl": "https://pitcheye.dev/rules/db-rls-permissive-using-true"
}Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/db-rls-permissive-using-true
raw markdown
# db/rls-permissive-using-true
- **severity:** warn
- **pack:** db
- **docs:** https://pitcheye.dev/rules/db-rls-permissive-using-true
## whyItBreaks
`USING (true)` is RLS switched on in name only: any authenticated (or anonymous, for SELECT grants) caller matches every row. It is usually added to silence a "new row violates row-level security policy" error, which means the write path is now open to the whole tenant population.
## bad
```ts
CREATE POLICY "p" ON public.invoices FOR UPDATE USING (true);
```
## good
```ts
CREATE POLICY "p" ON public.invoices FOR UPDATE USING (auth.uid()::text = owner_id);
```
## suggestedFix
Scope the predicate to the owner, e.g. `USING (auth.uid()::text = user_id)` and the same expression for `WITH CHECK`.
## commands
```bash
npx @pitcheye/check . --pack db
```
```json
{"tool":"explain_rule","arguments":{"ruleId":"db/rls-permissive-using-true"}}
```