Skip to content

chore(db): commit production RLS policies as a baseline migration - #42

Merged
DCT-Berinyuy merged 1 commit into
devfrom
rls-policies-baseline
Sep 27, 2026
Merged

DCT-Berinyuy merged 1 commit into
devfrom
rls-policies-baseline

Conversation

@DCT-Berinyuy

Copy link
Copy Markdown
Collaborator

Puts every row-level security policy production enforces into version control, and fixes why it wasn't there.

What

  • supabase/migrations/20260927220000_rls_policies_baseline.sql: 17 enable row level security + 44 policies (public and storage schemas), generated from pg_policies/pg_class in production on 2026-09-27 — not hand-written.
  • Explicit drop policy if exists for the four policies removed tonight. Needed because 20260602130000_escrow_payment_flow.sql still creates escrow_update_buyer; replaying migrations would otherwise restore it.
  • .gitignore: it ignored all of supabase/ since the initial commit, so every new migration or edge function was silently left out unless force-added. Now only supabase/.branches/, supabase/.temp/ and .env files are ignored.

Behavior
No change. Against production it drops and recreates each policy with its current definition. Run it in one transaction (the Supabase CLI does per migration).

Deliberately not fixed here (each gets its own migration): self-editable columns via profiles/listings UPDATE, public boost_payments SELECT, anonymous donations inserts, duplicate favorites/messages policies, books bucket upload without a folder check.

Test plan

Snapshot of all 44 policies on 17 RLS tables (public + storage), generated
from pg_policies in production after the GHSA-xq84-qm9j-hf6p fixes.
Explicitly drops the four policies removed during the incident so that
replaying 20260602130000 cannot restore escrow_update_buyer.

No behavior change: a no-op against production.

.gitignore ignored all of supabase/ since the initial commit, so new
migrations and edge functions were silently left out of git. Only local
CLI state and .env files are ignored now.

Co-authored-by: Copilot App <[email protected]>
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
book-bridge Ready Ready Preview Sep 27, 2026 9:21pm UTC

@DCT-Berinyuy
DCT-Berinyuy merged commit 5f4b1f7 into dev Sep 27, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 9ace960f Deployed Sep 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant