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 1n5BaO-0007Vx-H4 for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 19:04:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5BaN-0007xp-02 for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 19:04:35 +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 1n5BaM-0007xg-Lu for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 19:04:34 +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 1n5BaG-0003G4-9J for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 19:04:33 +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 205J4QkE796773; Wed, 5 Jan 2022 14:04:26 -0500 From: Tom Lane To: Dominique Devienne cc: pgsql-general@lists.postgresql.org Subject: Re: Trouble DROP'ing a ROLE, despite REVOKE'ing its privileges In-reply-to: References: <792111.1641407185@sss.pgh.pa.us> Comments: In-reply-to Dominique Devienne message dated "Wed, 05 Jan 2022 19:42:42 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <796771.1641409466.1@sss.pgh.pa.us> Date: Wed, 05 Jan 2022 14:04:26 -0500 Message-ID: <796772.1641409466@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk [ please keep the list cc'd ] Dominique Devienne writes: > On Wed, Jan 5, 2022 at 7:26 PM Tom Lane wrote: >> That will only revoke privileges that were granted by the role >> doing the REVOKE, so I surmise that you did this as some other role. > Hmmm, that's interesting... But it brings up something I didn't think of. > The point of making a NOLOGIN ROLE for the owner of all DB objects, > is to be able to GRANT that ROLE to several LOGIN USERs, which are > all basicall Administrators of that system. So any one of them should be > able to DROP the whole shebang, but what you are saying seems to be > that only the admin that *originally* created the "shebang" can get rid of > "owner" ROLE, or a SUPERUSER of course. Is that correct? The admins would need to be careful to SET ROLE to the shared role when manipulating privileges granted by that role --- either to grant them, or to revoke them. Alternatively, they could be careful to specify "GRANTED BY shared_role" in all these commands. But I think our coverage for that option isn't complete, especially in older branches. (IIRC there is some hack that causes superuser-issued revokes to nuke privileges granted by the object's owner, even without an explicit GRANTED BY. But that doesn't apply to ordinary users.) regards, tom lane