Unix Technical Forum

plpythonu

This is a discussion on plpythonu within the Pgsql General forums, part of the PostgreSQL category; --> Hello, someone can tell me if is secure to create external python modules and import them to functions/procedures/triggers to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 11:18 PM
Alexandre da Silva
 
Posts: n/a
Default plpythonu

Hello,
someone can tell me if is secure to create external python modules and
import them to functions/procedures/triggers to use?

I am doing the following:

function/procedure/trigger:

CREATE OR REPLACE FUNCTION tabela_be_i_tg_fx() RETURNS trigger AS $body$
from dbfunctions.postgres.pg_trigger import TestTrigger as fx
fe = fx()
return fe.execute(args=TD["args"], event=TD["event"], when=TD["when"],
level=TD["level"], name=TD["name"], relid=TD["relid"], new=TD["new"],
old=TD["old"], pl_py=plpy)
$body$
LANGUAGE plpythonu;


at python module I have:


class TestTrigger(object):
def execute(self, args, event, when, level, name, relid, new, old,
pl_py):
new["group_name"]='__modified__'
return 'MODIFY'


all this works properly (on windows and linux), but I don't know if is
the correct way to use plpythonu, and if I will have future problems.

Another question is that I have read in some discussion list (old
message year 2003) the possibility of plpython be removed from
postgresql, this information is valid yet?

sorry bad English

Thank's for all

--
Alexandre da Silva
Analista de Sistemas - Bacharel em Sistemas de Informação (2003-2007)


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 11:18 PM
Stuart Bishop
 
Posts: n/a
Default Re: plpythonu

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHkK5GAfqZj7rGN0oRAnQTAKCEqj74QpgsI7mquBbIp5 v4GFbmdwCdGqDA
x49fkDHxIgUZK9SJxIbqdhs=
=uNc/
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:18 PM
Erik Jones
 
Posts: n/a
Default Re: plpythonu


On Jan 18, 2008, at 7:48 AM, Stuart Bishop wrote:
> plpython !=3D plpythonu.
>
> plpython was the 'secure' sandboxed version. The Python devs gave up
> supporting any sort of sandboxing feature in Python declaring it
> impossib=
> le.


Someone should definitely take a look at this: http://
sayspy.blogspot.com/2007/05/i-have-finished-securing-python.html

That guy claims he's locked down the python interpreter there.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 11:18 PM
Marko Kreen
 
Posts: n/a
Default Re: plpythonu

On 1/18/08, Erik Jones <erik@myemma.com> wrote:
> On Jan 18, 2008, at 7:48 AM, Stuart Bishop wrote:
> > plpython !=3D plpythonu.
> >
> > plpython was the 'secure' sandboxed version. The Python devs gave up
> > supporting any sort of sandboxing feature in Python declaring it
> > impossib=
> > le.

>
> Someone should definitely take a look at this: http://
> sayspy.blogspot.com/2007/05/i-have-finished-securing-python.html
>
> That guy claims he's locked down the python interpreter there.


Interesting. But the problem has never been in locking down
the interpreter vX.Y, but locking down interpreter vX.Y+1, when
previously work was done on vX.Y. Without upstream developers
cooperation this has been too painful.

So the interesting thing in the posting is not that he succeeded
locking Python down, but that he is pushing the patch to core.

--
marko

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 11:19 PM
Sim Zacks
 
Posts: n/a
Default Re: plpythonu

I'm a fan of unsecured languages in the database.
Obviously they should only be used by people who understand the difference.
I wouldn't want python locked down.
That would prevent so many different external functions that can now be integrated into the database.

Among other things that I currently do with plpythonu is a function that reads a template file,
populates it with data and saves the file to the server. It then FTPs the file to another server.
It certainly can all be done outside of the database, but it is so much easier (and less maintenance)
to include it as a function.

Sim


Erik Jones wrote:
>
> On Jan 18, 2008, at 7:48 AM, Stuart Bishop wrote:
>> plpython !=3D plpythonu.
>>
>> plpython was the 'secure' sandboxed version. The Python devs gave up
>> supporting any sort of sandboxing feature in Python declaring it
>> impossib=
>> le.

>
> Someone should definitely take a look at this:
> http://sayspy.blogspot.com/2007/05/i...ng-python.html
>
> That guy claims he's locked down the python interpreter there.
>
> Erik Jones
>
> DBA | Emma®
> erik@myemma.com
> 800.595.4401 or 615.292.5888
> 615.292.0777 (fax)
>
> Emma helps organizations everywhere communicate & market in style.
> Visit us online at http://www.myemma.com
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-09-2008, 11:19 PM
Alvaro Herrera
 
Posts: n/a
Default Re: plpythonu

Sim Zacks wrote:
> I'm a fan of unsecured languages in the database.
> Obviously they should only be used by people who understand the difference.
> I wouldn't want python locked down.
> That would prevent so many different external functions that can now
> be integrated into the database.
>
> Among other things that I currently do with plpythonu is a function
> that reads a template file, populates it with data and saves the file
> to the server. It then FTPs the file to another server. It certainly
> can all be done outside of the database, but it is so much easier (and
> less maintenance) to include it as a function.


Having the trusted language does not mean you lose the untrusted one.
We have both plperl and plperlu, for example.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:49 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com