pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kenneth Marshall <ktm@it.is.rice.edu>
To: Keith Worthington <keithw@narrowpathinc.com>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: plperl user function
Date: Fri, 22 Apr 2005 07:41:30 -0500
Message-ID: <20050422124130.GB14229@it.is.rice.edu> (raw)
In-Reply-To: <20050422121739.M32137@narrowpathinc.com>
References: <20050421194438.M68704@narrowpathinc.com>
	<42680480.7080805@commandprompt.com>
	<20050421200109.M30783@narrowpathinc.com>
	<42680F29.4030907@commandprompt.com>
	<20050422121739.M32137@narrowpathinc.com>

Keith,

The untrusted language function is not neccessarily any less
secure than the trusted language function. You just need to
vet the function more carefully because it is allowed access
to the local filesystem and other system functions. Once the
function is created, only those who are given execute permission
can run it.

Ken

On Fri, Apr 22, 2005 at 08:29:39AM -0400, Keith Worthington wrote:
> 
> > > This leaves me with two questions.
> > > 1)  Why can I not use "use strict;" or "use warnings;" as they are
> > >     apparently good perl programming practice.  I say apparently
> > >     because if you remember I started learning this language 3 days
> > >     ago and must be considered a neophyte. :-)
> 
> > You can't use "use" instruction for security reason. All disk access
> > are denied and use need a disk access.
> > 
> > I think you need to use plperlu.
> 
> Yes.  That fixed my use problems.  I am not sure I like the idea of using an
> untrusted language.  I wonder if it causes a potential security issue.
> 
> > 2)  What is wrong with the use of RETURN?
> 
> According to Michael (whose email I can't access at the moment) it has to be
> lowercase.  I never dreamed Perl would be case sensitive but after changing
> the case, voila! :-)
>  
> > > Another question:  Is there an issue with using the untrusted perl
> > > language?
> > 
> > IIRC you have to be a postgresql superuser (postgres) to execute an 
> > untrusted language function.
> 
> I just tested the untrusted function using a normal user and it worked.
> 
> > > If the code is tested and working is there any real reason to
> > > continue to have "use strict;" and "use warnings;" in the function?
> > 
> > Only for manageability in the future.
> 
> Hmmm well I have this gut feeling that it is better to use a trusted language
> than an untrusted one but I have no idea if that is supported by fact.  My
> inclination is that now that the function is working and tested that I should
> comment out the two "use" commands and recreate the function with the trusted
> version.
> 
> Kind Regards,
> Keith
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



view thread (10+ messages)  latest in thread

Message-ID: <20050422124130.GB14229@it.is.rice.edu>
Permalink:  ../20050422124130.GB14229@it.is.rice.edu/
Also on:    postgresql.org/message-id/20050422124130.GB14229@it.is.rice.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: ktm@it.is.rice.edu, keithw@narrowpathinc.com
  Subject: Re: plperl user function
  In-Reply-To: <20050422124130.GB14229@it.is.rice.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox