Re: Grantor name gets lost when grantor role dropped

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-bugs(at)postgresql(dot)org, mr-russ(at)pws(dot)com(dot)au
Subject: Re: Grantor name gets lost when grantor role dropped
Date: 2007-05-04 16:24:39
Message-ID: 3814.1178295879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> So I'm currently considering the following alternatives:

> 1. do nothing at all with pg_shdepend. Upon role deletion, seqscan
> pg_auth_members and reject the drop altogether if there is a role
> granted to another which mentions the to-be-dropped role ID as grantor.
> This is easiest in terms of code (it's even mentioned in the comments in
> DropRole).

> 2. record one pg_shdepend entry for each role that has granted something
> to each role (unless the grantor is the same role being granted, in
> which case we needn't record anything). So if role A grants Z and X to
> C, and role B grants Y and W to C, C now has access to W, Y, X and Z and
> there are two pg_shdepend entries:
> C -> A
> C -> B
> So dropping a role would be disallowed automatically without any code
> changes, with the checkSharedDependencies() call that's already in
> DropRole. Adding a role membership would require a bit more work,
> because we'd first need to check that there's not already a pg_shdepend
> entry for that combination. Removing a role membership also becomes
> more work; we need to check that no other grant depends on the same
> grantor before removing the entry.

Both of these have got race conditions ... not but what the dependency
code has got race condition problems already, but maybe we should try
to avoid introducing more? I haven't got any better ideas though.

Why is it that we record grantor at all? One could argue that granting
membership in a role is done on behalf of that role and there's no real
need to remember exactly who did it.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2007-05-04 16:34:01 Re: Grantor name gets lost when grantor role dropped
Previous Message DNS 2007-05-04 15:35:56 Re: PGSQL - WARNING: 25P01: there is no transaction in progress

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-05-04 16:26:38 Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Previous Message Hiroshi Inoue 2007-05-04 15:59:05 Re: psqlodbc - psqlodbc: Put Autotools-generated files into subdirectory