fix: prevent non-superuser roles from dropping supabase_privileged_role#2150
Open
utkarash2991 wants to merge 1 commit into
Open
fix: prevent non-superuser roles from dropping supabase_privileged_role#2150utkarash2991 wants to merge 1 commit into
utkarash2991 wants to merge 1 commit into
Conversation
PostgreSQL Extension Dependency Analysis: PR #2150
SummaryNo extensions had dependencies with MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Extension DependenciesPostgreSQL 17 Extension DependenciesOrioleDB 17 Extension Dependencies |
PostgreSQL Package Dependency Analysis: PR #2150
SummaryNo packages had MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Dependency ChangesExtracting PostgreSQL 15 dependencies...
Runtime Closure Size
Raw Dependency ClosurePostgreSQL 17 Dependency ChangesExtracting PostgreSQL 17 dependencies...
Runtime Closure Size
Raw Dependency Closure |
b1ce9a3 to
96996bf
Compare
za-arthur
reviewed
May 12, 2026
Comment on lines
+4
to
+6
| CREATE ROLE test_reserved_attacker CREATEROLE; | ||
| GRANT test_reserved_attacker TO postgres; | ||
| SET ROLE test_reserved_attacker; |
Contributor
There was a problem hiding this comment.
I suggest to test postgres role which is non-superuser on tests.
Suggested change
| CREATE ROLE test_reserved_attacker CREATEROLE; | |
| GRANT test_reserved_attacker TO postgres; | |
| SET ROLE test_reserved_attacker; | |
| -- Switch to the postgres role (non-superuser) to test supautils behavior | |
| SET ROLE postgres; |
Author
There was a problem hiding this comment.
sure . Taking care in next revision.
96996bf to
55906f9
Compare
soedirgo
approved these changes
May 12, 2026
Add supabase_privileged_role to supautils.reserved_roles so non-superusers with CREATEROLE cannot drop it on PG 15, where PG's native ADMIN OPTION check (introduced in PG 16) does not apply. PG 16+ requires ADMIN OPTION to drop a non-superuser role: https://github.com/postgres/postgres/blame/REL_16_STABLE/src/backend/commands/user.c#L1175 This check is absent in PG 15: https://github.com/postgres/postgres/blob/REL_15_STABLE/src/backend/commands/user.c#L986 Fixes: https://linear.app/supabase/issue/PSQL-1205
55906f9 to
e6c9267
Compare
za-arthur
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add supabase_privileged_role to supautils.reserved_roles so non-superusers with CREATEROLE cannot drop it on PG 15, where PG's native ADMIN OPTION check (introduced in PG 16) does not apply.
PG 16+ requires ADMIN OPTION to drop a non-superuser role: https://github.com/postgres/postgres/blame/REL_16_STABLE/src/backend/commands/user.c#L1175
This check is absent in PG 15:
https://github.com/postgres/postgres/blob/REL_15_STABLE/src/backend/commands/user.c#L986
Fixes: https://linear.app/supabase/issue/PSQL-1205