diff --git a/apps/web/migrations/2023-01-06_rls.sql b/apps/web/migrations/2023-01-06_rls.sql index 41e91871..970ee68f 100644 --- a/apps/web/migrations/2023-01-06_rls.sql +++ b/apps/web/migrations/2023-01-06_rls.sql @@ -67,7 +67,7 @@ CREATE POLICY "connection_creator_access" ON "public"."pipeline" -- Contains secrets that shouldn't be publicly available ALTER TABLE "public"."integration" ENABLE ROW LEVEL SECURITY; -ALTER TABLE "public"."migrations" ENABLE ROW LEVEL SECURITY; +ALTER TABLE "public"."_migrations" ENABLE ROW LEVEL SECURITY; ALTER TABLE "public"."institution" ENABLE ROW LEVEL SECURITY; -- Should this be allowed? CREATE POLICY "public_readable" ON public.institution FOR SELECT USING (true); diff --git a/apps/web/migrations/2023-04-02_0140_admin_user.sql b/apps/web/migrations/2023-04-02_0140_admin_user.sql index 61f07ad9..e624cc89 100644 --- a/apps/web/migrations/2023-04-02_0140_admin_user.sql +++ b/apps/web/migrations/2023-04-02_0140_admin_user.sql @@ -20,9 +20,9 @@ $$; -- even though empirically it works because this is security we are gonna be more cautious. -- Will see if the supabase team has any ideas... -- @see https://usevenice.slack.com/archives/C04NUANB7FW/p1680462683033239 -CREATE OR REPLACE FUNCTION auth.is_admin() - RETURNS boolean - LANGUAGE sql +CREATE OR REPLACE FUNCTION auth.is_admin() + RETURNS boolean + LANGUAGE sql STABLE AS $function$ select nullif(current_setting('request.jwt.claims', true), '')::jsonb #> '{app_metadata,isAdmin}' = 'true'::jsonb @@ -37,7 +37,7 @@ CREATE POLICY "admin_access" ON "public"."integration" USING (auth.is_admin()); CREATE POLICY "admin_access" ON "public"."resource" USING (auth.is_admin()); CREATE POLICY "admin_access" ON "public"."pipeline" USING (auth.is_admin()); -CREATE POLICY "admin_access" ON "public"."migrations" USING (auth.is_admin()); +CREATE POLICY "admin_access" ON "public"."_migrations" USING (auth.is_admin()); DO $$ BEGIN diff --git a/apps/web/migrations/2023-04-29_1549_multi_tenant.sql b/apps/web/migrations/2023-04-29_1549_multi_tenant.sql index fcbf3650..2f098519 100644 --- a/apps/web/migrations/2023-04-29_1549_multi_tenant.sql +++ b/apps/web/migrations/2023-04-29_1549_multi_tenant.sql @@ -7,7 +7,7 @@ DROP POLICY IF EXISTS admin_access ON institution; DROP POLICY IF EXISTS admin_access ON integration; DROP POLICY IF EXISTS admin_access ON resource; DROP POLICY IF EXISTS admin_access ON pipeline; -DROP POLICY IF EXISTS admin_access ON migrations; +DROP POLICY IF EXISTS admin_access ON _migrations; DROP FUNCTION IF EXISTS auth.is_admin; DROP PROCEDURE IF EXISTS auth.set_user_admin;