Re: Specification for Trusted PLs?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Specification for Trusted PLs?
Date: 2010-05-24 03:19:31
Message-ID: 4BF9F043.1080506@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck wrote:
>>
>> ISTM we are in danger of confusing several different things. A user
>> that doesn't want data to be shared should not stash it in global
>> objects. But to me, trusting a language is not about making data
>> private, but about not allowing the user to do things that are
>> dangerous, such as referencing memory, or the file system, or the
>> operating system, or network connections, or loading code which might
>> do any of those things.
>
> How is "loading code which might do any of those things" different
> from writing a stored procedure, that accesses data, a careless
> "superuser" left in a global variable? Remember, the code of a PL
> function is "open" source - like in "everyone can select from
> pg_proc". You really don't expect anyone to scan for your global
> variables just because they can write functions in the same language?
>

Well, that threat arises from the unsafe actions of the careless
superuser. And we could at least ameliorate it by providing a per role
data stash, at very little cost, as I mentioned. It's not like we don't
know about such threats, and I'm certainly not pretending they don't
exist. The 9.0 PL/Perl docs say:

The %_SHARED variable and other global state within the language is
public data, available to all PL/Perl functions within a session.
Use with care, especially in situations that involve use of multiple
roles or SECURITY DEFINER functions.

But the threats I was referring to arise if the language allows them to,
without any requirement for unsafe actions by another user. Protecting
against those is the essence of trustedness in my mind at least.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-05-24 05:27:25 Re: Stefan's bug (was: max_standby_delay considered harmful)
Previous Message Craig Ringer 2010-05-24 03:16:58 Re: Specification for Trusted PLs?