Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6093D1337B39 for ; Tue, 1 Feb 2011 13:31:40 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 61872-06 for ; Tue, 1 Feb 2011 17:31:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail0.aip.de (maigret.aip.de [141.33.160.2]) by mail.postgresql.org (Postfix) with SMTP id 9AAE713364DE for ; Tue, 1 Feb 2011 13:31:32 -0400 (AST) Received: (qmail 25036 invoked from network); 1 Feb 2011 16:26:00 -0000 Received: from cashmere.aip.de (141.33.4.98) by mailout.aip.de with SMTP; 1 Feb 2011 16:25:59 -0000 Received: from cashmere.aip.de (localhost.localdomain [127.0.0.1]) by cashmere.aip.de (8.13.8/8.13.8) with ESMTP id p11HVVOE006789; Tue, 1 Feb 2011 18:31:31 +0100 Received: (from swhite@localhost) by cashmere.aip.de (8.13.8/8.13.8/Submit) id p11HVVrT006788; Tue, 1 Feb 2011 18:31:31 +0100 X-Authentication-Warning: cashmere.aip.de: swhite set sender to swhite@aip.de using -f Date: Tue, 1 Feb 2011 18:31:31 +0100 From: Steve White To: Pavel Stehule Cc: Tom Lane , pgsql-bugs@postgresql.org Subject: Re: Feature request: include script file into function body Message-ID: <20110201173131.GA6707@cashmere.aip.de> References: <20110201112120.GA1327@cashmere.aip.de> <26900.1296576145@sss.pgh.pa.us> <20110201164422.GA3023@cashmere.aip.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.2i "Organization: Astrophysikalisches Institut Potsdam" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/10 X-Sequence-Number: 29282 Hi Pavel, On 1.02.11, Pavel Stehule wrote: > Hello > > 2011/2/1 Steve White : > > Hi Tom, > > > > This seems like a detail that is beside the point I'm making. > > But security is important, so let's think about it. > > > > PostgreSQL has an \i command, which loads the text from any readable file > > interpretes and executes it as further PostgreSQL commands.  I'm proposing > > a similar mechanism that would load a file containing script language, and > > process it as though it were in the current funcition body. > > > > Isn't the \i command a similar security hole? > > if you ran psql under "postgres" account, then it is. > > I don't think, so your idea is good too. What about caching? Code of > stored procedures stays in session cache. Who will ensure, so your > cache is fresh? > Another good point that is beside the point I was making. But OK we can discuss that too. I would think, it should work exactly as if the text had been textually included, the first time the function is compiled, exactly as the inline text is handled now. > Why you need a direct link to source files? > There are several reasons, a couple of which are mentioned in the discussion in the pgsql-general list. http://archives.postgresql.org/pgsql-general/2011-01/msg00870.php Cheers! > Regards > > Pavel Stehule > > > > > If somehow loading script text for a function is substantially different > > from loading it by \i, and if there is some problem, it seems to me that > > some simple restriction could solve it, such as restricting the directories > > from which such files can be read.  But I'm just guessing here. > > > > I'll leave it to the security experts explicitly by amending my original > > proposal with this: > > > >        " -- without doing anything stupid that would open a security hole." > > > > Cheers again! > > > > > > 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. > >> > >>                       regards, tom lane > >> > > > > -- > > | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - > > | Steve White                                             +49(331)7499-202 > > | E-Science                                        Zi. 27  Villa Turbulenz > > | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - > > | Astrophysikalisches Institut Potsdam (AIP) > > | An der Sternwarte 16, D-14482 Potsdam > > | > > | Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz > > | > > | Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026 > > | -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - > > > > -- > > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-bugs > > > -- | - - - - - - - - - - - - - - - - - - - - - - - - - | Steve White +49(331)7499-202 | E-Science Zi. 27 Villa Turbulenz | - - - - - - - - - - - - - - - - - - - - - - - - - | Astrophysikalisches Institut Potsdam (AIP) | An der Sternwarte 16, D-14482 Potsdam | | Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz | | Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026 | - - - - - - - - - - - - - - - - - - - - - - - - -