Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC6w4-0008WO-Cq for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 22:03:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oC6w3-0006bg-2f for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 22:03:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC6w2-0006aS-Q4 for pgsql-hackers@lists.postgresql.org; Thu, 14 Jul 2022 22:03:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oC6w0-0005Qb-LJ for pgsql-hackers@postgresql.org; Thu, 14 Jul 2022 22:03:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26EM3j503159282; Thu, 14 Jul 2022 18:03:45 -0400 From: Tom Lane To: Nathan Bossart cc: Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: pg_parameter_aclcheck() and trusted extensions In-reply-to: <20220714215225.GA3173833@nathanxps13> References: <20220706224727.GA2158260@nathanxps13> <2995921.1657212060@sss.pgh.pa.us> <3126292.1657828950@sss.pgh.pa.us> <20220714215225.GA3173833@nathanxps13> Comments: In-reply-to Nathan Bossart message dated "Thu, 14 Jul 2022 14:52:25 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3159280.1657836225.1@sss.pgh.pa.us> Date: Thu, 14 Jul 2022 18:03:45 -0400 Message-ID: <3159281.1657836225@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > On Thu, Jul 14, 2022 at 04:02:30PM -0400, Tom Lane wrote: >> I noted something that ought to be looked at separately: >> validate_option_array_item() seems like it needs to be taught about >> grantable permissions on GUCs. I think that right now it may report >> permissions failures in some cases where it should succeed. > Which cases do you think might be inappropriately reporting permissions > failures? It looked to me like this stuff was mostly used for > pg_db_role_setting, which wouldn't be impacted by the current set of > grantable GUC permissions. Is the idea that you should be able to do ALTER > ROLE SET for GUCs that you have SET permissions for? Well, that's what I'm wondering. Obviously that wouldn't *alone* be enough permissions, but it seems like it could be a component of it. Specifically, this bit: /* manual permissions check so we can avoid an error being thrown */ if (gconf->context == PGC_USERSET) /* ok */ ; else if (gconf->context == PGC_SUSET && superuser()) /* ok */ ; else if (skipIfNoPermissions) return false; seems like it's trying to duplicate what set_config_option would do, and it's now missing a component of that. If it shouldn't check per-GUC permissions along with superuser(), we should add a comment explaining why not. regards, tom lane