Re: Why security-definer functions are executable by public by default?

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: depesz(at)depesz(dot)com
Cc: pasman pasmański <pasman(dot)p(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why security-definer functions are executable by public by default?
Date: 2011-04-06 15:31:11
Message-ID: 4D9C873F.9020308@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/06/2011 07:41 AM, hubert depesz lubaczewski wrote:
> On Wed, Apr 06, 2011 at 09:06:50AM +0200, pasman pasmański wrote:
>>> was pointed to the fact that security definer functions have the same
>>> default privileges as normal functions in the same language - i.e. if
>>> the language is trusted - public has the right to execute them.
>>>
>>> maybe i'm missing something important, but given the fact that security
>>> definer functions are used to get access to things that you usually
>>> don't have access to - shouldn't the privilege be revoked by default,
>>> and grants left for dba to decide?
>>>
>>
>> you can create function in schema accesible to dba only.
>
> sure. and I can revoke the privileges and grant the ones I need.
>
> I know I can *fix* it. But I just think that the default should be the
> same as with untrusted languages.

As was said earlier the point of SECURITY DEFINER is to allow
non-privileged users access to privileged content. When a trusted
function is created it is has the default of SECURITY INVOKER that
restricts it privileges to that of the calling user. Switching to
SECURITY DEFINER is a dba decision on grants already.

>
> depesz
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2011-04-06 15:34:14 Re: Auto Adjust Age
Previous Message Carlos Mennens 2011-04-06 15:30:43 Re: Auto Adjust Age