From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nicolas Paris <nicolas.paris@riseup.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Default Privilege Table ANY ROLE
Date: Fri, 16 Nov 2018 14:55:37 -0500
Message-ID: <20181116195537.GH3415@tamriel.snowman.net> (raw)
In-Reply-To: <12333.1542228819@sss.pgh.pa.us>
References: <20181114141608.ryvolxl7v7z2grzi@riseup.net>
<306e4be880a264c701be5dfa667a1e95de76e175.camel@cybertec.at>
<20181114202055.a23bgy354qnmo7jn@riseup.net>
<12333.1542228819@sss.pgh.pa.us>
Greetings,
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Maybe I'm missing something, but doesn't this solve your problem
> as stated?
>
> ALTER DEFAULT PRIVILEGES IN SCHEMA myschema GRANT SELECT ON TABLES TO public;
That just means that the 'ROLE' in the result is the current role, as
per the docs:
-----
The name of an existing role of which the current role is a member. If
FOR ROLE is omitted, the current role is assumed.
-----
There was much discussion of being able to have 'FOR ALL ROLES' or
similar for ALTER DEFAULT PRIVILEGES when it went in, but there was a
lot of concern about one user getting to define the default privileges
for objects created by some other user.
The thought mentioned up-thread of having a 'group role' which can be
assigned to a role and then used for the default privileges when a role
creates an object seems like a neat idea, but I'm not sure how we'd deal
with overlaps. Specifically:
User u1, member of role r1.
Role r1 has CREATE rights on schema s1.
DEFAULT PRIVILEGES on schema s1 for r1 say GRANT SELECT ON TABLES TO r2.
User u1 runs CREATE TABLE t1 in s1.
Table t1 has GRANT SELECT ON t1 TO r2 applied.
On that vein, I'd love it if table t1 was then also OWNED by r1, as that
is the role which allows the CREATE to happen.
The issue here though is that a given user 'u1' could have access to the
schema 's1' through multiple other roles and there's no way to say which
role to use, and obviously we'd want it to somehow be deterministic.
If we did allow the 'FOR ALL ROLES' as suggested- who would be allowed
to set that? I certainly don't want more superuser-only things, but
currently a schema owner isn't allowed to set the privileges on objects
in their schema on a per-object level, at least not explicitly, and we
don't allow them to set DEFAULT PRIVILEGES for some other role:
=*> alter default privileges for role r2 in schema ts grant select on tables to r1;
ERROR: must be member of role "r2"
I do think there's an argument to be made for having a default role who
is explicitly allowed to set/change the privileges on objects in the
system, but in an ideal world that role wouldn't be allowed to access
any of the data in the system. Such a role could have this right,
perhaps.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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: sfrost@snowman.net, tgl@sss.pgh.pa.us, nicolas.paris@riseup.net
Subject: Re: Default Privilege Table ANY ROLE
In-Reply-To: <20181116195537.GH3415@tamriel.snowman.net>
References: <20181114141608.ryvolxl7v7z2grzi@riseup.net> <306e4be880a264c701be5dfa667a1e95de76e175.camel@cybertec.at> <20181114202055.a23bgy354qnmo7jn@riseup.net> <12333.1542228819@sss.pgh.pa.us> <20181116195537.GH3415@tamriel.snowman.net>
* 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