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 1oC6l6-0007rl-1n for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 21:52:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oC6l4-0000T0-Al for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2022 21:52:30 +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 1oC6l3-0000Sr-W6 for pgsql-hackers@lists.postgresql.org; Thu, 14 Jul 2022 21:52:30 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oC6l0-0005LM-Jy for pgsql-hackers@postgresql.org; Thu, 14 Jul 2022 21:52:28 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so9838459pjo.3 for ; Thu, 14 Jul 2022 14:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=znmRE9ujnyFbViub1wnZPN+luMriWQRwQRd0bJ4bKvs=; b=anif18ByOqyuBrAi5t8G1Ur4559hYUqz2VzZ66gmpNB2CyjIJRySnYtPHpRgHzC33L 0LfnhWeYSV9zKZ+yKmuC1GF0bd4y/AAtQ69JgMe/T0dJIzI+4sEO8vFQXcvVlvRIdVln SfQvpDa6FhBkAF6xBvFMP6Ei/oQRSJZzOJd3AImE9jlvFury71T+cp6nMP+Li4ELhmuM BTfINTi4ocgzG/7Kip+OVsTzv0GCVtOg8/zQ6rG2QqoXDR+iP9y1xP87sR7/v8xS/PHu 6uIN7ChcGTWFUHAusi+EI4EM/yaIMml80NKzQp1jlyYhX/+Yj8dufoKi91oj2/b1dmXA DsOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=znmRE9ujnyFbViub1wnZPN+luMriWQRwQRd0bJ4bKvs=; b=dtwHKKxLHHhlpYWOKaDu4VvvDv+/vX6CYi8BiKn5HC9wQLKxKEmgRmaCaLWdCSu38+ YR/aUzivmUvr+ga8akX+yooHRnR6wlbWECmxEbj8TJsE/HOA6E9uvBuRk9VZaz64Ba7O rgc/RajtiZBTIBfEeOMu22LoJ2FsTNhjDt0WMm6FHChlzr1QCbJzDDQDdarTstOKiipL FgODr7/d147Ch/pAV9VdQtZsJYVTDBlYD5CEHfunv0DWJ2afojfR36V2KGRfhFnd49OL 8SEniQkHpot68UyMBsBUKlVToeI2nsnw3TgNtK8pgoVVFJOyAaJm7ypyV/nrJySLp50G t8wg== X-Gm-Message-State: AJIora/W4MMmmZEayft4BQHfWPtHp0VcfB+NPN5H0+d1OycgoVrCgguT hD/u7qKb1p13D38+nJiHtueTMWXpxD4= X-Google-Smtp-Source: AGRyM1v0MyLr3APBWPanc76mGQKoc7dNn/KIUtEr8WNOjE7OsjX0IHWCZ45e0r33vTKatJJOdlDSmQ== X-Received: by 2002:a17:902:f111:b0:16b:f440:5ce0 with SMTP id e17-20020a170902f11100b0016bf4405ce0mr10203808plb.163.1657835545475; Thu, 14 Jul 2022 14:52:25 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id l1-20020a63f301000000b00415320bc31dsm1869400pgh.32.2022.07.14.14.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 14:52:24 -0700 (PDT) Date: Thu, 14 Jul 2022 14:52:25 -0700 From: Nathan Bossart To: Tom Lane Cc: Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: pg_parameter_aclcheck() and trusted extensions Message-ID: <20220714215225.GA3173833@nathanxps13> References: <20220706224727.GA2158260@nathanxps13> <2995921.1657212060@sss.pgh.pa.us> <3126292.1657828950@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3126292.1657828950@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jul 14, 2022 at 04:02:30PM -0400, Tom Lane wrote: > Here's a draft patch for that. I initially ran around and changed all > the set_config_option callers as I threatened before, but as I did it > I could not help observing that they were all changing in exactly the > same way: basically, they were passing GetUserId() if the GucContext > is PGC_S_SESSION and BOOTSTRAP_SUPERUSERID otherwise. Not counting > guc.c internal call sites, there is a grand total of one caller that > fails to fit the pattern. So that brought me around to liking the idea > of keeping set_config_option's API stable by making it a thin wrapper > around another function with an explicit role argument. The result, > attached, poses far less of an API/ABI hazard than I was anticipating. > If you're not poking into the GUC tables you have little to fear. > > Most of the bulk of this is mechanical changes to pass the source > role around properly in guc.c's data structures. That's all basically > copy-and-paste from the code to track the source context (scontext). At first glance, this looks pretty reasonable to me. > 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? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com