Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/files/postgresql_config/supautils.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ supautils.privileged_extensions_superuser = 'supabase_admin'
supautils.privileged_role = 'supabase_privileged_role'
supautils.privileged_role_allowed_configs = 'auto_explain.*, deadlock_timeout, log_lock_waits, log_min_duration_statement, log_min_messages, log_parameter_max_length, log_replication_commands, log_statement, log_temp_files, pg_net.batch_size, pg_net.ttl, pg_stat_statements.*, pgaudit.log, pgaudit.log_catalog, pgaudit.log_client, pgaudit.log_level, pgaudit.log_relation, pgaudit.log_rows, pgaudit.log_statement, pgaudit.log_statement_once, pgaudit.role, pgrst.*, plan_filter.*, safeupdate.enabled, session_replication_role, track_functions, track_io_timing, wal_compression'
supautils.reserved_memberships = 'pg_read_server_files, pg_write_server_files, pg_execute_server_program, supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, authenticator'
supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*'
supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*, supabase_privileged_role'
supautils.hint_roles = 'anon, authenticated, service_role'
17 changes: 17 additions & 0 deletions nix/tests/expected/supautils_reserved_roles.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- verify non-superuser postgres role cannot drop supabase_privileged_role
BEGIN;
-- Switch to the postgres role (non-superuser) to test supautils behavior
SET ROLE postgres;
-- SAVEPOINT is needed to recover from the expected error and continue the transaction
SAVEPOINT before_drop;
DROP ROLE supabase_privileged_role;
ERROR: "supabase_privileged_role" is a reserved role, only superusers can modify it
ROLLBACK TO SAVEPOINT before_drop;
RESET ROLE;
SELECT rolname FROM pg_roles WHERE rolname = 'supabase_privileged_role';
rolname
--------------------------
supabase_privileged_role
(1 row)

ROLLBACK;
16 changes: 16 additions & 0 deletions nix/tests/sql/supautils_reserved_roles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- verify non-superuser postgres role cannot drop supabase_privileged_role
BEGIN;

-- Switch to the postgres role (non-superuser) to test supautils behavior
SET ROLE postgres;

-- SAVEPOINT is needed to recover from the expected error and continue the transaction
SAVEPOINT before_drop;
Comment thread
za-arthur marked this conversation as resolved.
DROP ROLE supabase_privileged_role;
ROLLBACK TO SAVEPOINT before_drop;

RESET ROLE;

SELECT rolname FROM pg_roles WHERE rolname = 'supabase_privileged_role';

ROLLBACK;
Loading