postgres.git / summary / log / commit / refs

commit    2c7a2a00a0867754d9e6e103057406ce953964cc
Author:   Noah Misch <noah@leadboat.com>
Date:     Mon Nov 06 14:14:13 2023 +0000
First released in: 17.0, 11.22, 12.17, 13.13, 14.10, 15.5, 16.1

    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.


src/backend/utils/init/miscinit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index edbd838ba52..7828791ed26 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -767,6 +767,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); } [parent: 28b609550af0]