fix: update build system RLS policies for consistency#1404
Conversation
Update RLS policies for build_requests, build_logs, and daily_build_time tables to use the consistent pattern used across the codebase: - Use check_min_rights() instead of direct EXISTS queries - Use get_identity_org_appid() when app_id is available (preferred) - Use get_identity_org_allowed() only when app_id is unavailable (fallback) - Support both authenticated and anon roles for API key auth This fixes the native build system by ensuring proper access control that matches the patterns used in apps, channels, and app_versions tables. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis SQL migration standardizes Row Level Security policies across three tables—build_requests, build_logs, and daily_build_time—by replacing direct EXISTS-based access checks with a unified pattern using Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)supabase/migrations/**/*.sql📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧠 Learnings (9)📓 Common learnings📚 Learning: 2025-12-24T14:11:10.256ZApplied to files:
📚 Learning: 2026-01-08T00:40:00.524ZApplied to files:
📚 Learning: 2026-01-08T00:40:00.524ZApplied to files:
📚 Learning: 2026-01-08T00:40:00.524ZApplied to files:
📚 Learning: 2025-12-23T02:53:12.055ZApplied to files:
📚 Learning: 2026-01-08T00:40:00.524ZApplied to files:
📚 Learning: 2025-12-23T02:53:12.055ZApplied to files:
📚 Learning: 2025-12-25T11:22:13.039ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (4)
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 (3.5.0)supabase/migrations/20260109000000_fix_build_system_rls_consistency.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: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Summary
build_requests,build_logs, anddaily_build_timetables to use consistent patternsget_identity_org_appid()when app_id is available (preferred)get_identity_org_allowed()only when app_id is unavailable (fallback)authenticatedandanonroles to enable API key authenticationMotivation
The native build system RLS policies were inconsistent with the rest of the codebase. They used direct
EXISTSqueries withauth.uid()instead of the standardcheck_min_rights()andget_identity_org_appid()functions used across other tables like apps, channels, and webhooks.This inconsistency caused issues with:
Business Impact
Revenue Generation: A working native build system is essential for Capgo's growth. By fixing the RLS policies:
Test Plan
supabase db resetto apply migration locally🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.