pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bryn Llewellyn <bryn@yugabyte.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: jeremy@musicsmith.net, pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"
Date: Fri, 11 Feb 2022 17:05:20 -0500
Message-ID: <2188505.1644617120@sss.pgh.pa.us> (raw)
In-Reply-To: <46C22E9C-280C-446E-911F-6915702E554E@yugabyte.com>
References: <0994D6C4-EDF0-4854-B528-88DDE429172E@yugabyte.com>
	<CAKFQuwZUuL6ek+6noEg13eXJBqK9WKhQww-wn+pqowf+Qub3UA@mail.gmail.com>
	<46C22E9C-280C-446E-911F-6915702E554E@yugabyte.com>

Bryn Llewellyn <bryn@yugabyte.com> writes:
> I confess that I'm surprised by the choice of the default behavior. It seems to be at odds with the principle of least privilege that insists that  you actively opt in to any relevant privilege.

I'd be the first to agree that this behavior sacrifices security
principles for convenience.  However, it's not that big a deal
in practice, because functions that aren't SECURITY DEFINER can't
do anything that the caller couldn't do anyway.  You do need to
be careful about the default PUBLIC grant if you're making a
SECURITY DEFINER function, but that's a minority use-case.

(I wonder if it'd be practical or useful to emit a warning when
granting permissions on an object that already has a grant of
the same permissions to PUBLIC.  That would at least cue people
who don't understand about this behavior that they ought to look
more closely.)

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <2188505.1644617120@sss.pgh.pa.us>
Permalink:  ../2188505.1644617120@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2188505.1644617120@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, bryn@yugabyte.com, david.g.johnston@gmail.com
  Subject: Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"
  In-Reply-To: <2188505.1644617120@sss.pgh.pa.us>
  References: <0994D6C4-EDF0-4854-B528-88DDE429172E@yugabyte.com> <CAKFQuwZUuL6ek+6noEg13eXJBqK9WKhQww-wn+pqowf+Qub3UA@mail.gmail.com> <46C22E9C-280C-446E-911F-6915702E554E@yugabyte.com> <2188505.1644617120@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