Skip to content

The same access rule created over and over

Scan rule · RSC-ARC-021

  • Architecture & SEO
  • Severity: Medium

Finds RLS policies recreated three or more times across the migrations (each after a `drop policy`) — the sign that the AI is spiralling on an access rule instead of setting it correctly once.

Why this matters

In vibe coding the AI proposes a policy, it does not fit, the next migration drops it and creates a new one — repeatedly. Recreating the same policy three times is no longer iteration but spiralling: the rule was never understood as a whole.

In the field corpus, repos with this policy churn carried a critical RLS gap far more often than repos without — the last version is often a quick fix that still leaves the door open.

Fix: step back and ask what the same access logic looks like done cleanly — usually one policy per operation with `auth.uid() = user_id`. That is shorter and safer than the next rewrite.

Scan tier

  • Repo access (deep scan)

How to fix it

State the access rule cleanly once: one policy per operation (select/insert/update/delete), owner bound via `auth.uid()` — instead of rewriting the same policy again.

Scan your own app for free