Skip to content

Commit d459f9d

Browse files
committed
feat: revoke supabase_storage_admin from postgres
Prevents Storage schema & migrations from being modified
1 parent 53c160a commit d459f9d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- migrate:up
2+
revoke supabase_storage_admin from postgres;
3+
revoke create on schema storage from postgres;
4+
revoke all on storage.migrations from anon, authenticated, service_role, postgres;
5+
6+
-- migrate:down

migrations/tests/database/privs.sql

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
SELECT database_privs_are(
32
'postgres', 'postgres', ARRAY['CONNECT', 'TEMPORARY', 'CREATE']
43
);
@@ -28,3 +27,6 @@ SELECT schema_privs_are('extensions', 'postgres', array['CREATE', 'USAGE']);
2827
SELECT schema_privs_are('extensions', 'anon', array['USAGE']);
2928
SELECT schema_privs_are('extensions', 'authenticated', array['USAGE']);
3029
SELECT schema_privs_are('extensions', 'service_role', array['USAGE']);
30+
31+
-- Role memberships
32+
SELECT isnt_member_of('supabase_storage_admin', 'postgres');

migrations/tests/test.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BEGIN;
55

66
CREATE EXTENSION IF NOT EXISTS pgtap;
77

8-
SELECT plan(34);
8+
SELECT no_plan();
99

1010
\ir fixtures.sql
1111
\ir database/test.sql

0 commit comments

Comments
 (0)