Re: Prevent extension creation in temporary schemas

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Sergei Kornilov <sk(at)zsrv(dot)org>, "Kuroda, Hayato" <kuroda(dot)hayato(at)jp(dot)fujitsu(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Chris Travers <chris(dot)travers(at)adjust(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "dimitri(at)citusdata(dot)com" <dimitri(at)citusdata(dot)com>
Subject: Re: Prevent extension creation in temporary schemas
Date: 2019-03-01 16:35:55
Message-ID: 31029.1551458155@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Thu, Feb 28, 2019 at 10:52:52PM -0500, Tom Lane wrote:
>> If you're suggesting that we disable that security restriction
>> during extension creation, I really can't see how that'd be a
>> good thing ...

> No, I don't mean that. I was just wondering if someone can set
> search_path within the SQL script which includes the extension
> contents to bypass the restriction and the error. They can always
> prefix such objects with pg_temp anyway if need be...

You'd have to look in namespace.c to be sure, but I *think* that
we don't consult the temp schema during function/operator lookup
even if it's explicitly listed in search_path.

It might be possible for an extension script to get around this with
code like, say,

CREATE TRIGGER ... EXECUTE PROCEDURE @extschema(at)(dot)myfunc();

although you'd have to give up relocatability of the extension
to use @extschema(at)(dot) (Maybe it was a bad idea to not provide
that symbol in relocatable extensions? A usage like this doesn't
prevent the extension from being relocated later.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-01 16:38:20 Re: pg_partition_tree crashes for a non-defined relation
Previous Message Andres Freund 2019-03-01 16:35:21 Re: NOT IN subquery optimization