Re: What user to defaults execute as?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: pgsql-general(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: What user to defaults execute as?
Date: 2002-10-30 20:03:21
Message-ID: 20021030200321.GA6798@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Oct 30, 2002 at 08:27:37 -0600,
Bruno Wolff III <bruno(at)wolff(dot)to> wrote:
> Do default expressions execute with access of the user doing the insert
> or the owner of the table?
> What I was thinking was that the owner of a table may want to allow people
> to do inserts into a table and update a sequence through a default expression,
> but not let people change the sequence directly.
> A quick look under create table (in the 7.3b3 docs) didn't turn up any
> information and I don't remember running accross anything covering this
> previously.

OK, I went and tested this and I found that default expressions (at least
nextval) are executed with the permissions of the user doing the insert
and not the owner of the table.

I would like to suggest this be changed for two reasons:

It may not be obvious to the end user that inserting a row into a table
may result in other things being done with their access. I.e. you can
use a default expression as a trojan and by getting someone to do an insert
into a table you created can be used to do bad things.

I think that the table owner may want to let be insert rows into a table
with a serial column, but not want to also let people reset the sequence
number to arbitrary values.

This would be similar to rules working with the access of the rule owner.
While I am not sure about triggers, it certainly is possible to get
a similar effect be having the referenced function run with the security
of the definer.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Benson 2002-10-30 20:06:54 Re: permission prob: granted, but still denied
Previous Message Tom Lane 2002-10-30 19:12:38 Re: backing up corrupt database

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-10-30 20:14:22 7.2.3 vacuum bug
Previous Message Tom Lane 2002-10-30 19:43:36 Concerns about statement-timeout patch