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 1oYDBR-00074P-JC for pgsql-general@arkaria.postgresql.org; Tue, 13 Sep 2022 21:11:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYDBQ-0007sX-Hk for pgsql-general@arkaria.postgresql.org; Tue, 13 Sep 2022 21:11:04 +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 1oYDBQ-0007sN-85 for pgsql-general@lists.postgresql.org; Tue, 13 Sep 2022 21:11:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYDBN-0007Qc-8P for pgsql-general@lists.postgresql.org; Tue, 13 Sep 2022 21:11:03 +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 28DLAwNh2384349; Tue, 13 Sep 2022 17:10:58 -0400 From: Tom Lane To: Christophe Pettus cc: Bryn Llewellyn , "David G. Johnston" , pgsql-general list Subject: Re: Is it possible to stop sessions killing eachother when they all authorize as the same role? In-reply-to: References: <10F360BB-3149-45E6-BFFE-10B9AE31F1A6@yugabyte.com> <2F078227-5EEF-4553-89FF-046A6AF12F25@yugabyte.com> <1883844.1663044542@sss.pgh.pa.us> <0CAFB5D3-8EB2-4EE1-A50B-7CBFCB7D558D@yugabyte.com> <1AD29374-E9DD-4640-AE0C-882A20A909D9@yugabyte.com> Comments: In-reply-to Christophe Pettus message dated "Tue, 13 Sep 2022 11:47:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2384347.1663103458.1@sss.pgh.pa.us> Date: Tue, 13 Sep 2022 17:10:58 -0400 Message-ID: <2384348.1663103458@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Christophe Pettus writes: > It works correctly for me, on MacOS: > swift-239:~ xof$ psql > psql (14.5) > Type "help" for help. > xof=# create user r1; > CREATE ROLE > xof=# revoke execute on function pg_terminate_backend from r1; > REVOKE > xof=# > \q > swift-239:~ xof$ psql -U r1 xof > psql (14.5) > Type "help" for help. > xof=> select pg_terminate_backend(123); > ERROR: permission denied for function pg_terminate_backend > xof=> Hmm ... that should actually *not* have worked. pg_terminate_backend has the default ACL for functions, namely GRANT EXECUTE TO PUBLIC. If you revoke from a specific user, nothing will change because the PUBLIC grant is still there and they can still use it. Perhaps you'd already revoked from public in this database? (I recall that somewhere we have some code that warns about no-op grants. I wonder if issuing a warning for no-op revokes would be helpful.) Jeremy's nearby theory that the REVOKE was done in a different database seems like a pretty good explanation of Bryn's issue. regards, tom lane