pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christophe Pettus <xof@thebuild.com>
Cc: Bryn Llewellyn <bryn@yugabyte.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?
Date: Tue, 13 Sep 2022 17:10:58 -0400
Message-ID: <2384348.1663103458@sss.pgh.pa.us> (raw)
In-Reply-To: <F16876E2-4803-4E59-AA42-3FD4C4ABB97E@thebuild.com>
References: <10F360BB-3149-45E6-BFFE-10B9AE31F1A6@yugabyte.com>
	<CAKFQuwYr78FAFX4dFL3Mp4qiBZHzQtChTmO91d9FvYn09GzCfw@mail.gmail.com>
	<2F078227-5EEF-4553-89FF-046A6AF12F25@yugabyte.com>
	<CAKFQuwZVq-LerGMTN0E3_7MqhJwtuJuzf0GSnKG32mH_Qf24Zw@mail.gmail.com>
	<E34C9A5F-832D-444C-8798-89BA8F5B386C@yugabyte.com>
	<1883844.1663044542@sss.pgh.pa.us>
	<0CAFB5D3-8EB2-4EE1-A50B-7CBFCB7D558D@yugabyte.com>
	<D9F27FEC-BFE1-4F84-BFBA-CB857202291D@thebuild.com>
	<1AD29374-E9DD-4640-AE0C-882A20A909D9@yugabyte.com>
	<F16876E2-4803-4E59-AA42-3FD4C4ABB97E@thebuild.com>

Christophe Pettus <xof@thebuild.com> 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





view thread (32+ messages)  latest in thread

Message-ID: <2384348.1663103458@sss.pgh.pa.us>
Permalink:  ../2384348.1663103458@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2384348.1663103458@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, xof@thebuild.com, bryn@yugabyte.com, david.g.johnston@gmail.com
  Subject: Re: Is it possible to stop sessions killing eachother when they all authorize as the same role?
  In-Reply-To: <2384348.1663103458@sss.pgh.pa.us>
  References: <10F360BB-3149-45E6-BFFE-10B9AE31F1A6@yugabyte.com> <CAKFQuwYr78FAFX4dFL3Mp4qiBZHzQtChTmO91d9FvYn09GzCfw@mail.gmail.com> <2F078227-5EEF-4553-89FF-046A6AF12F25@yugabyte.com> <CAKFQuwZVq-LerGMTN0E3_7MqhJwtuJuzf0GSnKG32mH_Qf24Zw@mail.gmail.com> <E34C9A5F-832D-444C-8798-89BA8F5B386C@yugabyte.com> <1883844.1663044542@sss.pgh.pa.us> <0CAFB5D3-8EB2-4EE1-A50B-7CBFCB7D558D@yugabyte.com> <D9F27FEC-BFE1-4F84-BFBA-CB857202291D@thebuild.com> <1AD29374-E9DD-4640-AE0C-882A20A909D9@yugabyte.com> <F16876E2-4803-4E59-AA42-3FD4C4ABB97E@thebuild.com> <2384348.1663103458@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox