Re: Foreign keys breaks tables permissions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Jan Wieck <wieck(at)debis(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Foreign keys breaks tables permissions
Date: 2000-05-19 17:44:15
Message-ID: 8838.958758255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> 1. Why is RI_FKey_check() using SELECT FOR UPDATE and not plain SELECT?
>> 2. What permissions should SELECT FOR UPDATE require?

> UPDATE seems reasonable. SELECT is no good because it would give read-only
> users the locking power of users with write access.

>> If the existing code is correct on both these points, then I think the
>> answer is that there is no bug: updating a table that has a foreign
>> key reference will require update rights on the master as well.

> I don't think that's acceptable.

I don't like it either, but if an FK check must use SELECT FOR UPDATE
then anyone who can trigger an FK check has the ability to create a
write-class lock on the referenced table. Wrapping the FK check
in a SETUID trigger doesn't change that fundamental fact; it'll just
mean that the user triggering the check is now able to create a lock
that he doesn't have the privileges to create directly.

This is perhaps the least undesirable of the choices we have, but it's
still a security hole.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2000-05-21 16:45:20 Re: Foreign keys breaks tables permissions
Previous Message Peter Eisentraut 2000-05-19 17:39:14 Re: Foreign keys breaks tables permissions

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-05-19 17:44:42 Re: question about index cost estimates
Previous Message Peter Eisentraut 2000-05-19 17:39:26 Re: HEADS UP: CVSROOT location changed ...

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-05-19 17:48:15 Re: Re[2]: lower() for varchar data by creating an index
Previous Message Peter Eisentraut 2000-05-19 17:39:38 Re: Re[2]: lower() for varchar data by creating an index