Re: Controlling changes in plpgsql variable resolution

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: Controlling changes in plpgsql variable resolution
Date: 2009-10-23 08:28:38
Message-ID: 1256286518.13273.14.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2009-10-20 at 10:32 -0400, Tom Lane wrote:
> That's only sane if you are 100% certain that there could not be a
> security issue arising from the change of behavior. Otherwise someone
> could for instance subvert a security-definer function by running it
> under the setting it wasn't written for. Personally I am not 100%
> certain of that.

This is pretty much equivalent to the issue of setting search_path for
security definer functions. Such settings that affect the semantics of
code should be overridden to a know safe value by such functions.

Still, making the setting SUSET will be very impractical. The superuser
will have to ensure that all current and future functions on the
installation conform to the setting that is chosen. This is pretty much
impossible. The other choice is to uglify every function with an
explicit setting. So in practice the only convenient and robust choice
is to leave it as is.

The correct solution, IMO, is that security definer functions need to
save the set of deemed-security-critical parameters automatically at
function creation time. Since we don't do that currently, I'd guess
that 50% of security definer functions out there are still unsafe about
search_path.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2009-10-23 08:28:45 Re: table corrupted
Previous Message Dimitri Fontaine 2009-10-23 08:24:43 Re: plpgsql EXECUTE will not set FOUND