diff options
author | Noah Misch <noah@leadboat.com> | 2023-11-06 06:14:13 -0800 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2023-11-06 06:14:17 -0800 |
commit | 7bbf4d03726200a8e42b48cac0b2a87abb7fb5fe (patch) | |
tree | 122c982b8b7998ea21612bbdd800838a712828bf | |
parent | 2893f2f40cfc2a7f6bd64b566f97140f8a379dd9 (diff) | |
download | postgresql-7bbf4d03726200a8e42b48cac0b2a87abb7fb5fe.tar.gz postgresql-7bbf4d03726200a8e42b48cac0b2a87abb7fb5fe.zip |
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.
-rw-r--r-- | src/backend/utils/init/miscinit.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index f6c1e7491dd..425498c1a74 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -708,6 +708,14 @@ InitializeSessionUserIdStandalone(void) AuthenticatedUserIsSuperuser = true; SetSessionUserId(BOOTSTRAP_SUPERUSERID, true); + + /* + * XXX This should set SetConfigOption("session_authorization"), too. + * Since we don't, C code will get NULL, and current_setting() will get an + * empty string. + */ + SetConfigOption("is_superuser", "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); } |