Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9BB6E9FB87A for ; Fri, 5 Oct 2007 12:01:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 36282-05 for ; Fri, 5 Oct 2007 12:01:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tinlc.com (unknown [72.18.206.65]) by postgresql.org (Postfix) with ESMTP id 64DC69F9955 for ; Fri, 5 Oct 2007 12:01:53 -0300 (ADT) Received: from localhost ([127.0.0.1]) by tinlc.com with smtp (Exim 4.60) (envelope-from ) id 1Idogx-0001rF-Hj; Fri, 05 Oct 2007 10:02:15 -0500 From: "Greg Sabino Mullane" To: pgsql-admin@postgresql.org Subject: Re: Executing external program from stored procedure X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <758d5e7f0710050151v23e30a58yb89d8e1e4e533153@mail.gmail.com> Date: Fri, 5 Oct 2007 15:02:15 -0000 X-Mailer: JoyMail 2.01 Message-ID: <460ad9e285a27c57c790b0339b4e427a@biglumber.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/26 X-Sequence-Number: 26940 -----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-----