fix: split channel_permission_overrides write policies#1860
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors write access policies on Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 SQLFluff (4.0.4)supabase/migrations/20260325045835_split_channel_permission_overrides_write_policies.sqlUser Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects: supabase/tests/26_test_rls_policies.sqlUser Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects: Comment |
|



Summary (AI generated)
FOR ALLpolicy onpublic.channel_permission_overrideswith explicitINSERT,UPDATE, andDELETEpoliciesSELECTpolicy forauthenticatedto remove the Supabase linter warning and reduce per-query policy evaluationSELECTpath forauthenticatedMotivation (AI generated)
channel_permission_overrides_admin_writewas defined asFOR ALL, which implicitly applied toSELECTand overlapped withchannel_permission_overrides_admin_select. Supabase flags that pattern because multiple permissive policies for the same role and action add unnecessary policy checks on every matching query.Business Impact (AI generated)
This removes a production schema warning, keeps RLS behavior explicit, and avoids avoidable policy-evaluation overhead on a permission table that is part of RBAC-sensitive permission flows.
Test Plan (AI generated)
PATH="/tmp/codex-bin:$PATH" bun scripts/supabase-worktree.ts startPATH="/tmp/codex-bin:$PATH" bunx supabase test db supabase/tests/26_test_rls_policies.sql --workdir /Users/martindonadieu/.codex/worktrees/a5cf/capgo/.context/supabase-worktrees/b701ac6eGenerated with AI
Summary by CodeRabbit
Chores
Tests