Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 46E191337BC4 for ; Tue, 1 Feb 2011 15:11:24 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 47446-02-7 for ; Tue, 1 Feb 2011 19:11:17 +0000 (UTC) X-Greylist: delayed 00:15:34.938284 by SQLgrey-1.7.6 Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by mail.postgresql.org (Postfix) with SMTP id CCADE1337BE8 for ; Tue, 1 Feb 2011 15:10:58 -0400 (AST) Received: (qmail 24403 invoked by uid 453); 24 Dec 2010 19:50:32 -0000 Received: from pc-00002.gpdnet.co.uk (HELO [192.168.1.2]) (192.168.1.2) by gpdnet.co.uk (qpsmtpd/0.83) with (AES256-SHA encrypted) ESMTPS; Fri, 24 Dec 2010 19:50:32 +0000 Message-ID: <4D485718.6010402@gpdnet.co.uk> Date: Tue, 01 Feb 2011 18:55:20 +0000 From: Gary Doades User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: Feature request: include script file into function body References: <20110201112120.GA1327@cashmere.aip.de> <26900.1296576145@sss.pgh.pa.us> <20110201164422.GA3023@cashmere.aip.de> <4D47EB12020000250003A0EE@gw.wicourts.gov> <20110201185004.GA7511@cashmere.aip.de> In-Reply-To: <20110201185004.GA7511@cashmere.aip.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/18 X-Sequence-Number: 29290 On 01/02/2011 6:50 PM, Steve White wrote: > Hi again, all, > > OK I think I now know what the misunderstanding is. > >> [Please don't top-post. Rearranged for clarity.] >> >> Steve White wrote: >>> On 1.02.11, Tom Lane wrote: >>>> Steve White writes: >>>>> It would be really nice to have a way to load script (especially >>>>> Python and Perl) from a separate file into a function body. >>>> This seems like a security hole, ie, you could use it to read any >>>> file the backend has access to. >> >>> Isn't the \i command a similar security hole? >> >> That is run by a client program on a client machine. If that is >> what you had in mind, a modification to the CREATE FUNCTION syntax >> is probably not the way to go. Just to throw a hypothetical out >> there, were you looking to effectively do a \i inside the string >> literal which is the function body, picking up a *client-side* file? >> >> That has its own problems, of course, but I'm just trying to get us >> onto the same page. >> >> -Kevin >> > I guess the "FROM filename" syntax wasn't a great choice, as it suggests > something completely different from what I was otherwise describing. > (In my own defense: I repeatedly qualified the syntax as a suggestion.) > > I *DO NOT MEAN* that a query should run about grabbing files off the > server, or wherever. > > I meant something like the replacement that happens with the \i command > in loading SQL, and under similar circumstances, except that somehow > non-SQL code is loadad in a function body. But functions *run* on the server, in the postgres server backend, so it would have to grab files from the server, which is where the security issue comes in. The \i command *runs* on the client under your own account and reads text into the *client*, not the server. The two things are completely different and run in completely different places. Cheers, Gary.