-
-
Notifications
You must be signed in to change notification settings - Fork 129
fix(rbac): block preview public channels #2713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
riderx
wants to merge
5
commits into
main
Choose a base branch
from
codex/guard-app-preview-public-channel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
749e0f2
fix(rbac): block preview public channels
riderx ca093f8
Merge branch 'main' into codex/guard-app-preview-public-channel
riderx a887bb7
Merge branch 'main' into codex/guard-app-preview-public-channel
riderx cfe3ea5
fix(rbac): restamp preview public channel guard and block updates
riderx 1ee7330
fix(rbac): require app settings to publicize via UPDATE RLS
riderx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
supabase/migrations/20260728111351_app_preview_public_channel_guard.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| -- A public/default channel changes app delivery settings. App-preview keys may | ||
| -- bootstrap private channels, but must not create or flip a channel to public. | ||
| -- Keep this in INSERT/UPDATE RLS because CLI/PostgREST can write the table | ||
| -- directly; the channel endpoint performs the matching guard for its admin and | ||
| -- raw-SQL paths. | ||
| DROP POLICY IF EXISTS "Allow RBAC channels insert" ON public.channels; | ||
| CREATE POLICY "Allow RBAC channels insert" | ||
| ON public.channels | ||
| FOR INSERT | ||
| TO anon, authenticated | ||
| WITH CHECK ( | ||
| public.rbac_check_permission_request( | ||
| public.rbac_perm_app_create_channel(), | ||
| owner_org, | ||
| app_id, | ||
| NULL::bigint | ||
| ) | ||
| AND ( | ||
| "public" IS FALSE | ||
| OR public.rbac_check_permission_request( | ||
| public.rbac_perm_app_update_settings(), | ||
| owner_org, | ||
| app_id, | ||
| NULL::bigint | ||
| ) | ||
| ) | ||
| AND ( | ||
| (version IS NULL AND rollout_version IS NULL) | ||
| OR public.rbac_check_permission_request( | ||
| public.rbac_perm_channel_promote_bundle(), | ||
| owner_org, | ||
| app_id, | ||
| NULL::bigint | ||
| ) | ||
| ) | ||
| ); | ||
|
|
||
| DROP POLICY IF EXISTS "Allow RBAC channels update" ON public.channels; | ||
| CREATE POLICY "Allow RBAC channels update" | ||
| ON public.channels | ||
| FOR UPDATE | ||
| TO anon, authenticated | ||
| USING ( | ||
| public.rbac_check_permission_request( | ||
| public.rbac_perm_channel_update_settings(), | ||
| owner_org, | ||
| app_id, | ||
| id | ||
| ) | ||
| ) | ||
| WITH CHECK ( | ||
| public.rbac_check_permission_request( | ||
| public.rbac_perm_channel_update_settings(), | ||
| owner_org, | ||
| app_id, | ||
| id | ||
| ) | ||
| AND ( | ||
| "public" IS FALSE | ||
| OR public.rbac_check_permission_request( | ||
| public.rbac_perm_app_update_settings(), | ||
| owner_org, | ||
| app_id, | ||
| NULL::bigint | ||
| ) | ||
| ) | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.