-
-
Notifications
You must be signed in to change notification settings - Fork 227
feat: add supabase_superuser role #1987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| -- migrate:up | ||
| do $$ | ||
| begin | ||
| if not exists (select from pg_roles where rolname = 'supabase_superuser') then | ||
| create role supabase_superuser; | ||
| grant supabase_superuser to postgres, supabase_etl_admin; | ||
| end if; | ||
| end $$; | ||
|
|
||
| -- migrate:down | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty down migration prevents clean rollback. The down migration is empty, which means rolling back this migration will not remove the 🔎 Consider adding a down migration -- migrate:down
+do $$
+begin
+ if exists (select from pg_roles where rolname = 'supabase_superuser') then
+ revoke supabase_superuser from postgres, supabase_etl_admin;
+ drop role supabase_superuser;
+ end if;
+end $$;🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,3 +10,38 @@ join pg_proc p | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| join pg_namespace n_func | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on p.pronamespace = n_func.oid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| where p.prorettype = 'event_trigger'::regtype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- postgres can create event triggers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set role postgres; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create function f() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| returns event_trigger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language plpgsql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| as $$ begin end $$; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create event trigger et | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on ddl_command_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| execute function f(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop event trigger et; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop function f(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reset role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- supabase_etl_admin can create event triggers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set role supabase_etl_admin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create schema s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create function s.f() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| returns event_trigger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language plpgsql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| as $$ begin end $$; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create event trigger et | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on ddl_command_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| execute function s.f(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- postgres can't drop supabase_etl_admin's event triggers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set role postgres; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop event trigger et; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set role supabase_etl_admin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop event trigger et; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop function s.f(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop schema s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reset role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify the expected behavior and add error handling. The comment at line 39 states "postgres can't drop supabase_etl_admin's event triggers," but the test doesn't explicitly handle the expected failure. If the 🔎 Add explicit error handlingConsider wrapping the expected-to-fail operation in a transaction or using -- postgres can't drop supabase_etl_admin's event triggers
set role postgres;
-drop event trigger et;
+do $$
+begin
+ drop event trigger et;
+ raise exception 'Expected failure: postgres should not be able to drop supabase_etl_admin event trigger';
+exception
+ when insufficient_privilege then
+ raise notice 'Correctly prevented: postgres cannot drop supabase_etl_admin event trigger';
+end $$;
+reset role;
-set role supabase_etl_admin;
+-- cleanup as supabase_etl_admin
+set role supabase_etl_admin;
drop event trigger et;📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n ansible/vars.yml | head -20Repository: supabase/postgres
Length of output: 639
🌐 Web query:
PostgreSQL 17.6.0 release orioledb version stability💡 Result:
Short answer: PostgreSQL 17.6.0 was released on August 14, 2025. OrioleDB is still a patched/extension-based storage engine for PostgreSQL 17 (beta series) that requires patched PostgreSQL binaries and is not yet recommended for general production use — you should treat it as experimental and test thoroughly before deploying. [1][2][3]
Sources:
🌐 Web query:
PostgreSQL 17.6.1 release version 068💡 Result:
Do you mean the official PostgreSQL community server, or a vendor build (Percona / Postgres Pro)? I found:
If by "version 068" you mean a package/release ID, build number, or a specific vendor package, tell me which distribution (OS/vendor) and I’ll look up the exact package/version details and provide links. References: [1] PostgreSQL 17.6 release notes, [2] PostgreSQL docs page for 17.6, [3] Percona announcement, [4] Percona release notes, [5] Postgres Pro 17.6.1 page, [6] Postgres Pro PostgreSQL 17.6 release notes.
🌐 Web query:
PostgreSQL 15.14 release version 068 security advisories💡 Result:
PostgreSQL 15.14 (released 2025‑08‑14) includes fixes for multiple security issues. Key security advisories/CVEs addressed in 15.14:
For authoritative details and full changelog see the PostgreSQL 15.14 release notes and the PostgreSQL security pages. [1][2]
Sources:
[1] PostgreSQL 15.14 release notes (E.2 Release 15.14).
[2] PostgreSQL Security Information / Security pages.
[3] Vendor/distro advisories summarizing addressed CVEs (Percona / CVE detail pages).
OrioleDB 17.6 is experimental and not recommended for production; clarify testing and vendor build status for non-standard versions.
The version identifiers with ".068" suffixes appear non-standard for PostgreSQL releases. OrioleDB 17.6 is explicitly in beta/experimental status and requires patched PostgreSQL binaries—confirm whether this is acceptable for your use case. PostgreSQL 17.6.1 does not exist in official community releases (only 17.6.0). Ensure these are documented Supabase custom builds and have been validated for your environment. PostgreSQL 15.14 does address known security issues (CVE-2025-8713, CVE-2025-8714, CVE-2025-8715)—verify that testing and deployment procedures account for the non-standard version format.
🤖 Prompt for AI Agents