From 155e87ef8129366d665968f64d1fc66676d07e16 Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Mon, 24 Jun 2024 17:41:07 +0200 Subject: [PATCH] fix: revert define search path in auth functions (#1634) Reverts supabase/auth#1616 Follow up to #1633 - more context there and in this discussion: https://supabase.slack.com/archives/C07A55TKL3S/p1719237535404369 --- .../20240612114525_set_search_path.up.sql | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 migrations/20240612114525_set_search_path.up.sql diff --git a/migrations/20240612114525_set_search_path.up.sql b/migrations/20240612114525_set_search_path.up.sql deleted file mode 100644 index 5d6ff2081..000000000 --- a/migrations/20240612114525_set_search_path.up.sql +++ /dev/null @@ -1,43 +0,0 @@ --- set the search_path to an empty string to force fully qualified names in the function -do $$ -begin - -- auth.uid() function - create or replace function auth.uid() - returns uuid - set search_path to '' - as $func$ - select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; - $func$ language sql stable; - - -- auth.role() function - create or replace function {{ index .Options "Namespace" }}.role() - returns text - set search_path to '' - as $func$ - select nullif(current_setting('request.jwt.claim.role', true), '')::text; - $func$ language sql stable; - - -- auth.email() function - create or replace function {{ index .Options "Namespace" }}.email() - returns text - set search_path to '' - as $func$ - select - coalesce( - current_setting('request.jwt.claim.email', true), - (current_setting('request.jwt.claims', true)::jsonb ->> 'email') - )::text - $func$ language sql stable; - - -- auth.jwt() function - create or replace function {{ index .Options "Namespace" }}.jwt() - returns jsonb - set search_path to '' - as $func$ - select - coalesce( - nullif(current_setting('request.jwt.claim', true), ''), - nullif(current_setting('request.jwt.claims', true), '') - )::jsonb; - $func$ language sql stable; -end $$;