Skip to content
Draft
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
4 changes: 2 additions & 2 deletions ansible/files/postgresql_config/supautils.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ supautils.restrict_extension_versions = 'warn'
supautils.privileged_extensions_superuser = 'supabase_admin'
supautils.privileged_role = 'supabase_privileged_role'
supautils.privileged_role_allowed_configs = 'auto_explain.*, deadlock_timeout, log_duration, log_lock_waits, log_min_duration_statement, log_min_error_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*, supabase_privileged_role'
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, supabase_integrations_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, supabase_integrations_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*, supabase_privileged_role'
supautils.hint_roles = 'anon, authenticated, service_role'
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ postgres_major:
- "17"
- orioledb-17
postgres_release:
postgresorioledb-17: "17.9.0.026-orioledb"
postgres17: "17.6.1.173"
postgres15: "15.14.1.173"
postgresorioledb-17: "17.9.0.027-orioledb-nr"
postgres17: "17.6.1.174-nr"
postgres15: "15.14.1.174-nr"
supabase_admin_agent_splay: 30s
###############################################################################################################
# The following block of yaml is for get_url and co throughout the playbook #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ grant create on database postgres to supabase_etl_admin;
create role supabase_read_only_user with login bypassrls;
grant pg_read_all_data to supabase_read_only_user;

-- Supabase integrations user (catch-all role for first-party integrations, e.g. Issue Inbox)
create user supabase_integrations_admin with login;
grant create on database postgres to supabase_integrations_admin;

-- Extension namespacing
create schema if not exists extensions;
create extension if not exists "uuid-ossp" with schema extensions;
Expand Down
2 changes: 1 addition & 1 deletion nix/packages/cli-config/postgresql.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ shared_preload_libraries = 'pg_stat_statements, pg_cron, pg_net, pgsodium, supab
#vault.getkey_script = '/path/to/pgsodium_getkey.sh'

# Supautils configuration
supautils.reserved_roles = 'supabase_admin,supabase_auth_admin,supabase_storage_admin,supabase_read_only_user,supabase_replication_admin,supabase_realtime_admin,supabase_functions_admin'
supautils.reserved_roles = 'supabase_admin,supabase_auth_admin,supabase_storage_admin,supabase_read_only_user,supabase_replication_admin,supabase_realtime_admin,supabase_functions_admin,supabase_integrations_admin'
supautils.reserved_memberships = 'pg_read_server_files,pg_write_server_files,pg_execute_server_program'
138 changes: 70 additions & 68 deletions nix/tests/expected/roles.out
Original file line number Diff line number Diff line change
Expand Up @@ -19,81 +19,83 @@ select
from pg_roles r
where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
order by rolname;
rolname | rolcreaterole | rolcanlogin | rolsuper | rolinherit | rolcreatedb | rolreplication | rolconnlimit | rolbypassrls | rolvaliduntil
----------------------------+---------------+-------------+----------+------------+-------------+----------------+--------------+--------------+---------------
anon | f | f | f | t | f | f | -1 | f |
authenticated | f | f | f | t | f | f | -1 | f |
authenticator | f | t | f | f | f | f | -1 | f |
dashboard_user | t | f | f | t | t | t | -1 | f |
pg_checkpoint | f | f | f | t | f | f | -1 | f |
pg_database_owner | f | f | f | t | f | f | -1 | f |
pg_execute_server_program | f | f | f | t | f | f | -1 | f |
pg_monitor | f | f | f | t | f | f | -1 | f |
pg_read_all_data | f | f | f | t | f | f | -1 | f |
pg_read_all_settings | f | f | f | t | f | f | -1 | f |
pg_read_all_stats | f | f | f | t | f | f | -1 | f |
pg_read_server_files | f | f | f | t | f | f | -1 | f |
pg_signal_backend | f | f | f | t | f | f | -1 | f |
pg_stat_scan_tables | f | f | f | t | f | f | -1 | f |
pg_write_all_data | f | f | f | t | f | f | -1 | f |
pg_write_server_files | f | f | f | t | f | f | -1 | f |
pgbouncer | f | t | f | t | f | f | -1 | f |
pgsodium_keyholder | f | f | f | t | f | f | -1 | f |
pgsodium_keyiduser | f | f | f | t | f | f | -1 | f |
pgsodium_keymaker | f | f | f | t | f | f | -1 | f |
pgtle_admin | f | f | f | t | f | f | -1 | f |
postgres | t | t | f | t | t | t | -1 | t |
service_role | f | f | f | t | f | f | -1 | t |
supabase_admin | t | t | t | t | t | t | -1 | t |
supabase_auth_admin | t | t | f | f | f | f | -1 | f |
supabase_etl_admin | f | t | f | t | f | t | -1 | t |
supabase_functions_admin | t | t | f | f | f | f | -1 | f |
supabase_privileged_role | f | f | f | t | f | f | -1 | f |
supabase_read_only_user | f | t | f | t | f | f | -1 | t |
supabase_replication_admin | f | t | f | t | f | t | -1 | f |
supabase_storage_admin | t | t | f | f | f | f | -1 | f |
(31 rows)
rolname | rolcreaterole | rolcanlogin | rolsuper | rolinherit | rolcreatedb | rolreplication | rolconnlimit | rolbypassrls | rolvaliduntil
-----------------------------+---------------+-------------+----------+------------+-------------+----------------+--------------+--------------+---------------
anon | f | f | f | t | f | f | -1 | f |
authenticated | f | f | f | t | f | f | -1 | f |
authenticator | f | t | f | f | f | f | -1 | f |
dashboard_user | t | f | f | t | t | t | -1 | f |
pg_checkpoint | f | f | f | t | f | f | -1 | f |
pg_database_owner | f | f | f | t | f | f | -1 | f |
pg_execute_server_program | f | f | f | t | f | f | -1 | f |
pg_monitor | f | f | f | t | f | f | -1 | f |
pg_read_all_data | f | f | f | t | f | f | -1 | f |
pg_read_all_settings | f | f | f | t | f | f | -1 | f |
pg_read_all_stats | f | f | f | t | f | f | -1 | f |
pg_read_server_files | f | f | f | t | f | f | -1 | f |
pg_signal_backend | f | f | f | t | f | f | -1 | f |
pg_stat_scan_tables | f | f | f | t | f | f | -1 | f |
pg_write_all_data | f | f | f | t | f | f | -1 | f |
pg_write_server_files | f | f | f | t | f | f | -1 | f |
pgbouncer | f | t | f | t | f | f | -1 | f |
pgsodium_keyholder | f | f | f | t | f | f | -1 | f |
pgsodium_keyiduser | f | f | f | t | f | f | -1 | f |
pgsodium_keymaker | f | f | f | t | f | f | -1 | f |
pgtle_admin | f | f | f | t | f | f | -1 | f |
postgres | t | t | f | t | t | t | -1 | t |
service_role | f | f | f | t | f | f | -1 | t |
supabase_admin | t | t | t | t | t | t | -1 | t |
supabase_auth_admin | t | t | f | f | f | f | -1 | f |
supabase_etl_admin | f | t | f | t | f | t | -1 | t |
supabase_functions_admin | t | t | f | f | f | f | -1 | f |
supabase_integrations_admin | f | t | f | t | f | f | -1 | f |
supabase_privileged_role | f | f | f | t | f | f | -1 | f |
supabase_read_only_user | f | t | f | t | f | f | -1 | t |
supabase_replication_admin | f | t | f | t | f | t | -1 | f |
supabase_storage_admin | t | t | f | f | f | f | -1 | f |
(32 rows)

select
rolname,
rolconfig
from pg_roles r
where rolname not in ('pg_create_subscription', 'pg_maintain', 'pg_use_reserved_connections')
order by rolname;
rolname | rolconfig
----------------------------+------------------------------------------------------------------------------------------
anon | {statement_timeout=3s}
authenticated | {statement_timeout=8s}
authenticator | {"session_preload_libraries=supautils, safeupdate",statement_timeout=8s,lock_timeout=8s}
dashboard_user |
pg_checkpoint |
pg_database_owner |
pg_execute_server_program |
pg_monitor |
pg_read_all_data |
pg_read_all_settings |
pg_read_all_stats |
pg_read_server_files |
pg_signal_backend |
pg_stat_scan_tables |
pg_write_all_data |
pg_write_server_files |
pgbouncer |
pgsodium_keyholder |
pgsodium_keyiduser |
pgsodium_keymaker |
pgtle_admin |
postgres | {"search_path=\"\\$user\", public, extensions"}
service_role |
supabase_admin | {"search_path=\"$user\", public, auth, extensions",log_statement=none}
supabase_auth_admin | {search_path=auth,idle_in_transaction_session_timeout=60000,log_statement=none}
supabase_etl_admin |
supabase_functions_admin |
supabase_privileged_role |
supabase_read_only_user | {default_transaction_read_only=on}
supabase_replication_admin |
supabase_storage_admin | {search_path=storage,log_statement=none}
(31 rows)
rolname | rolconfig
-----------------------------+------------------------------------------------------------------------------------------
anon | {statement_timeout=3s}
authenticated | {statement_timeout=8s}
authenticator | {"session_preload_libraries=supautils, safeupdate",statement_timeout=8s,lock_timeout=8s}
dashboard_user |
pg_checkpoint |
pg_database_owner |
pg_execute_server_program |
pg_monitor |
pg_read_all_data |
pg_read_all_settings |
pg_read_all_stats |
pg_read_server_files |
pg_signal_backend |
pg_stat_scan_tables |
pg_write_all_data |
pg_write_server_files |
pgbouncer |
pgsodium_keyholder |
pgsodium_keyiduser |
pgsodium_keymaker |
pgtle_admin |
postgres | {"search_path=\"\\$user\", public, extensions"}
service_role |
supabase_admin | {"search_path=\"$user\", public, auth, extensions",log_statement=none}
supabase_auth_admin | {search_path=auth,idle_in_transaction_session_timeout=60000,log_statement=none}
supabase_etl_admin |
supabase_functions_admin |
supabase_integrations_admin |
supabase_privileged_role |
supabase_read_only_user | {default_transaction_read_only=on}
supabase_replication_admin |
supabase_storage_admin | {search_path=storage,log_statement=none}
(32 rows)

-- Check all privileges of the roles on the schemas
select schema_name, privilege_type, grantee, default_for
Expand Down
Loading
Loading