Re: DELETE CASCADE

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: David Christensen <david(dot)christensen(at)crunchydata(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DELETE CASCADE
Date: 2021-06-09 07:17:52
Message-ID: d73461b8-fe8a-e838-d63a-aae097b619ab@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08.06.21 21:29, David Christensen wrote:
> > So basically where we are dispatching to the CASCADE guts, first
> check session user’s DELETE permission and throw the normal
> permissions error if they can’t delete?
>
> Actually, you also need appropriate SELECT permissions that correspond
> to the WHERE clause of the DELETE statement.
>
>
> So this would be both a table-level and column level check?  (It seems
> odd that we could configure a policy whereby we could DELETE an
> arbitrary row in the table, but not SELECT which one, but I can see that
> there could be information leakage implications here.)
>
> Other permissions-level things to consider, like RLS, or is this part
> automatic?  Do you happen to know offhand another instance in the code
> which takes these granular permissions into consideration?  Might help
> bootstrap both the understanding and the implementation of this.

All of this permissions checking code already exists in the executor, so
the question perhaps isn't so much which details to consider but how to
make use of that code. If you convince the trigger actions to run as
the invoker of the original DELETE rather than whatever they are doing
now, that should all work correctly. How to do that, I don't know right
now.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-06-09 07:21:45 Re: DELETE CASCADE
Previous Message tsunakawa.takay@fujitsu.com 2021-06-09 07:10:48 RE: Transactions involving multiple postgres foreign servers, take 2