Re: Remove default privilege from DB

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Durumdara <durumdara(at)gmail(dot)com>, Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Remove default privilege from DB
Date: 2018-02-16 16:23:13
Message-ID: CAKFQuwZhSfgStGjObw1W14dSrkjwFvg1GtzcOvzVc7q3o5gotg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 16, 2018 at 8:59 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Tom,
>
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> > Stephen Frost <sfrost(at)snowman(dot)net> writes:
> > > * David G. Johnston (david(dot)g(dot)johnston(at)gmail(dot)com) wrote:
> > >> ​Not sure if this is what you mean but there is no concept of
> "negative
> > >> state" in the permissions system. Everything starts out with no
> > >> permissions. Grant adds permissions and revoke un-adds granted
> > >> permissions.​ Revoking something that doesn't exist is either a
> no-op or a
> > >> warning depending on the context - either way its doesn't setup a
> > >> "forbidden" state for the permission.
> >
> > > This isn't entirely correct. Functions are the classic example where
> > > EXECUTE to PUBLIC is part of the default and the "negative" state of
> > > having a function where EXECUTE is REVOKE'd from PUBLIC is entirely
> > > reasonable and even common.
> >
> > FWIW, I thought David's description was fine. The fact that the initial
> > state of an object typically includes some positive grants doesn't change
> > the fact that there's no such thing as a negative grant. In particular,
> > if there is a GRANT TO PUBLIC, no amount of revoking that privilege from
> > individual users will have any effect, because the public grant is still
> > there.
>
> What I was particularly picking up on was the comment that "Everything
> starts out with no permissions" which implied, at least to me, the idea
> that no one has any rights on an object until those rights are GRANT'd,
> which isn't correct, as I described.
>

I think its more helpful to say "there are no inherent permissions" and
have someone ask "then why can I execute this function" and respond
"because the system places every user in to a group called PUBLIC which
(like all roles/groups) has a set of granted inheritable permissions; and
by default it gets ... on all newly created ...;". And, no, you
unfortunately cannot remove a user from the PUBLIC group. You can revoke
the permissions granted to PUBLIC by executing using REVOKE ... FROM PUBLIC.

Basically, you force the learner to confront/incorporate how the
default/PUBLIC privilege defaults system is configured to enhance the
usability of a "deny all first" based permission system. Starting from a
point of "users have these defaults" obscures that fact and leads to
questions like this - which as I said I had myself way back when. Starting
from the deny-all beginning was an "ah-ha! moment for me".

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ibrahim Edib Kokdemir 2018-02-16 16:35:22 Re: Database health check/auditing
Previous Message Melvin Davidson 2018-02-16 16:06:29 Re: Database health check/auditing