Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Noah Misch <noah(at)leadboat(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Jacob Champion <pchampion(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "chap(at)anastigmatix(dot)net" <chap(at)anastigmatix(dot)net>
Subject: Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)
Date: 2021-10-28 18:02:14
Message-ID: 42A6DBBF-400E-48F4-B04A-5220B374FDE3@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Oct 27, 2021, at 1:10 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> This is effectively the same thing as Mark's proposal, but just using
> a new kind of object (TENANT) where Mark used an existing kind of
> object (ROLE). And it addresses Noah's concern, perhaps, because with
> the approach the tenant administrator isn't a member of every role,
> but rather just gets the privileges of all the roles as if they were.
> You might argue that's a distinction without a difference, but I don't
> think so: the superuser is in effect a member of every role as things
> stand, and the whole idea of this project is to all for
> quasi-superusers who can administer a subset of the users in the
> system, so something of this kind seems like it has to exist for the
> proposal to achieve its object. But it need not be role membership per
> se, and maybe shouldn't be.

It feels to me that the traditional concept of users and groups could map, one-to-one, onto users and roles, but we've mapped both users and groups, many-to-one, onto roles, leaving no distinct concept of groups, and now we're proposing adding a concept called "tenant" that means something like "group". I find that simultaneously helpful and pretty confusing.

Compare that to the help and confusion created by my proposal. The idea that roles can own roles, just as roles can own tables, indexes, etc., doesn't seem confusing to me, but perhaps it does to others. If you accept that roles can own roles, then the idea that roles can drop roles that they own, or change characteristics of roles that they own, is entirely analogous to roles being able to drop or alter any other sort of object that they own. To me, that is perfectly consistent and unsurprising, but again, perhaps not to others.

Noah's concern, as I understood it, was not about roles owning roles, but about role membership being what controls if an event trigger fires. If anything, that concern stems from the lack of role ownership, not the existence of it, because I wrote the event trigger patch set to not depend on the role ownership patch set. Once you have a concept of role ownership, it is perfectly natural that the trigger could fire based on whether the trigger owner is the owner of (or the same as) the role performing the action. That completely sidesteps the concern about the event trigger role needing to be a member of any log-in role, because you no longer need the event trigger owner to be a member of the log-in role.

There are semantic details to be worked out with role ownership, such as whether a role owner automatically has the privileges of roles it owns, whether such privilege, if any, should behave à la INHERIT or NOINHERIT, whether superusers should own roles they create or whether there should be a special rule that superuser created roles should belong to the bootstrap superuser, etc. The patch set has taken a position on each of these, because it cannot be implemented without some choice being made, but many of these decisions could be changed if they are the source of confusion. If, on the other hand, having parallel concepts "role A owns role B" and "role C is a member of role D" is too confusing for people to ever keep straight, then perhaps we need something like "tenant" to help lessen the confusion.


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Asif Rehman 2021-10-28 18:03:36 Re: Proposal: allow database-specific role memberships
Previous Message Tom Lane 2021-10-28 17:46:49 Re: [PATCH v2] src/port/snprintf.c: Optimize the common base=10 case in fmtint