pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-admin@postgresql.org
Subject: Re: Executing external program from stored procedure
Date: Fri,  5 Oct 2007 15:02:15 -0000
Message-ID: <460ad9e285a27c57c790b0339b4e427a@biglumber.com> (raw)
In-Reply-To: <758d5e7f0710050151v23e30a58yb89d8e1e4e533153@mail.gmail.com>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> PL/Perl runs in tainted mode, so it will prevent you from
> accessing any files (which means you can relatively safely
> give an access to it for ordinary users and not worry too much
> about them doing system("rm -rf .");

Two minor nits: it's not taint mode (that's something else entirely 
in Perl). Pl/Perl runns in "safe mode" via the Safe module:

http://search.cpan.org/~jhi/perl-5.8.0/ext/Opcode/Safe.pm

Also, allowing a bare system call is really the fault of the person 
writing the function, and one should not rely upon trusted languages 
to prevent that sort of thing. :)

> Other approach, I think a bit better, would be to devise a scheme like this:

The listen approach is a good one, I agree, especially if the actual call 
takes a finite amount of time and is called from a trigger, as your insert 
or update will have to wait for the external program to finish before 
returning.

There are other untrusted languages (e.g. tcl) you could also try out, 
but Pl/Perl is probably the most functional and best supported.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200710051101
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFHBlHIvJuQZxSWSsgRA2ysAJ9STQNEHtCe0MvJ911QUrHkXJ+JswCgsE0o
qUcGE9gXUbClwx3KsLAjHNE=
=g3wJ
-----END PGP SIGNATURE-----





view thread (4+ messages)

Message-ID: <460ad9e285a27c57c790b0339b4e427a@biglumber.com>
Permalink:  ../460ad9e285a27c57c790b0339b4e427a@biglumber.com/
Also on:    postgresql.org/message-id/460ad9e285a27c57c790b0339b4e427a@biglumber.com

 · 

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-admin@postgresql.org
  Cc: greg@turnstep.com
  Subject: Re: Executing external program from stored procedure
  In-Reply-To: <460ad9e285a27c57c790b0339b4e427a@biglumber.com>

* 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