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 1ka0gl-0000ha-H6 for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Nov 2020 18:05:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ka0gj-0001l6-PL for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Nov 2020 18:05:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ka0gj-0001ky-JZ for pgsql-bugs@lists.postgresql.org; Tue, 03 Nov 2020 18:05:45 +0000 Received: from dd27502.kasserver.com ([85.13.146.49]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ka0gc-00013j-KA for pgsql-bugs@lists.postgresql.org; Tue, 03 Nov 2020 18:05:44 +0000 Received: from [192.168.0.52] (ip-37-201-154-176.hsi13.unitymediagroup.de [37.201.154.176]) by dd27502.kasserver.com (Postfix) with ESMTPSA id 6A01A60CA5BD; Tue, 3 Nov 2020 19:05:36 +0100 (CET) Subject: Re: User with BYPASSRLS privilege can't change password To: Tom Lane , Stephen Frost Cc: pgsql-bugs@lists.postgresql.org References: <923005.1604420579@sss.pgh.pa.us> <956994.1604425451@sss.pgh.pa.us> From: Wolfgang Walther Message-ID: <3e771893-1ed1-97e7-6c4a-7b0d00992103@technowledgy.de> Date: Tue, 3 Nov 2020 19:05:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <956994.1604425451@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Lane: > It's a little more subtle than that, but not much. Commit 491c029db > copied-and-pasted the logic used to deny non-superusers the privilege > to change anything about a superuser role. That was certainly not the > intention, because the error message was phrased differently from the > superuser case, but that was the effect. I propose the attached. Wouldn't the following change allow a non-superuser with createrole privilege to grant the replication privilege to a role that does not have that privilege, yet? This should still be forbidden, I think. @@ -739,7 +741,6 @@ AlterRole(AlterRoleStmt *stmt) createrole < 0 && createdb < 0 && canlogin < 0 && - isreplication < 0 && !dconnlimit && !rolemembers && !validUntil && This is because the "must be superuser to alter replication users" condition only triggers when the altered role already has isrepliaction, so isreplication could very well be >= 0 here. The other change looks good. Best Wolfgang