Skip to content

Commit 822c600

Browse files
nmischtuhaihe
authored andcommitted
Set GUC "is_superuser" in all processes that set AuthenticatedUserId.
It was always false in single-user mode, in autovacuum workers, and in background workers. This had no specifically-identified security consequences, but non-core code or future work might make it security-relevant. Back-patch to v11 (all supported versions). Jelte Fennema-Nio. Reported by Jelte Fennema-Nio.
1 parent 6c37f8f commit 822c600

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/backend/utils/init/miscinit.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,14 @@ InitializeSessionUserIdStandalone(void)
841841
AuthenticatedUserIsSuperuser = true;
842842

843843
SetSessionUserId(BOOTSTRAP_SUPERUSERID, true);
844+
845+
/*
846+
* XXX This should set SetConfigOption("session_authorization"), too.
847+
* Since we don't, C code will get NULL, and current_setting() will get an
848+
* empty string.
849+
*/
850+
SetConfigOption("is_superuser", "on",
851+
PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT);
844852
}
845853

846854

0 commit comments

Comments
 (0)