control-plane: change authz grants of unchanged_draft_specs view #1246
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.
Description:
Initially, the
unchanged_draft_specs
view was written as being owned by theauthenticated
role in postgres, to ensure that it always used the RLS policies of the caller. But Supabase has revoked thesuperuser
attribute of thepostgres
role and no longer provides a way to authenticate as a superuser. This means thatalter view ... set owner to authenticated
no longer works becauseauthenticated
does not have the necessary permission to create a view. See this thread for more.In this case, we're able to work around this by granting select permission to the
authenticated
role. This works because bothdraft_specs_ext
andlive_specs_ext
perform their own enforcement of authZ, so it's safe to bypass RLS.Also changes the name of the migration to fix a conflict.
Workflow steps:
I re-tested authZ of the view by:
aliceCo/
tenant and create a hello-world captureunchanged_draft_specs
bobCo/
tenant and repeat the above stepsunchanged_draft_specs
when querying as superuser, but only 2 rows when usingflowctl raw get
to query as alice or bob.This change is