fix(rbac): block preview public channels - #2713
Conversation
📝 WalkthroughWalkthroughPublic channel creation now requires settings-update permission in addition to channel-creation permission. The database insert policy and unit and lifecycle tests enforce and verify these authorization guards. ChangesPublic channel authorization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_577ec601-13f5-4795-991d-aa88a224e618) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_fa0907f3-988c-4aab-8f1d-9a7834fd8632) |
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: Cursor <cursoragent@cursor.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ab96f4b2-26d5-4bc9-ba2d-e0ed44955c91) |
|
@cubic-dev-ai review |
@riderx I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_68f59008-fe23-4ba5-9dba-bae8401d1f42) |



Summary
app.update_settingsto create a public/default channel.RLS execution model
public.channelsINSERTWITH CHECK; it runs once per inserted channel row from the CLI/PostgREST path.app.create_channelremains required for every new channel.public = trueadditionally requires the existing, caller-scopedapp.update_settingsRBAC check on the row owner app. App Preview does not receive that permission.owner_organdapp_idvalues.app.update_settingsguard before inserting.EXPLAIN and integration follow-up
EXPLAIN (ANALYZE, BUFFERS)and the affected lifecycle integration test are pending: the local Supabase runtime cannot start because Docker/Dory is unavailable (Cannot connect to .../.dory/dory.sock).Validation
bun lintbun lint:backendbun run typecheck:backendbunx vitest run tests/channel-post.unit.test.ts- 16 passedbun test:unit- 160 files / 1,065 tests passedNote
High Risk
Authorization boundary changes on channel creation and public flag updates affect delivery configuration; mistakes could block legitimate admins or leave a bypass path if API and RLS diverge.
Overview
App Preview keys can no longer create or mark channels as public/default, which would change app-wide delivery settings. That now requires
app.update_settingsin addition to the existing create/update channel permissions.The
POST /channelhandler rejectspublic: truewhen the caller lacksapp.update_settings(samecannot_access_apperror).public.channelsRLS INSERT/UPDATE policies mirror the rule so CLI/PostgREST direct writes cannot bypass the API.Unit tests cover create vs. update public-channel denials; the CLI preview lifecycle integration test asserts default-channel CLI creation and public channel POST are blocked and no public rows are persisted.
Reviewed by Cursor Bugbot for commit 1ee7330. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests