Forum: Ruby PlRuby(Postgres) and require

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C06869c119472a139eb163b72040b0db?d=identicon&s=25 Bertram Scharpf (Guest)
on 2007-01-09 15:10
(Received via mailing list)
Hi,

in PlRuby I am defining functions and I would like to load
some library:

  create function dummy() returns void language 'plruby' as $$
    require "yaml"
  $$;
  select dummy();

This yields in an "ERROR: Insecure operation - require". At
least the string "yaml"s tainted state is a reason for this.
Inside the library classes will be defined (i.e. constants
will be set) what is prohibited, too.

It is a very easy excercise to modify the PlRuby library so
that it loads "yaml" before $SAFE is set. But then the
system is no longer compatible to others. The question I
would like to ask therefore is more elaborate:

What other ways are there and which is the _best_ way to
include a library?

Thanks in advance,

Bertram
956f185be9eac1760a2a54e287c4c844?d=identicon&s=25 ts (Guest)
on 2007-01-09 15:58
(Received via mailing list)
>>>>> "B" == Bertram Scharpf <lists@bertram-scharpf.de> writes:

B> This yields in an "ERROR: Insecure operation - require". At

 By default, plruby run with $SAFE = 12

B> What other ways are there and which is the _best_ way to
B> include a library?

 You have 2 possibilities

  * compile plruby with $SAFE = 0

     ruby extconf.rb --with-safe-level=0 ...

  * look in the directories src/conversions to see what it do in some
    special cases.


Guy Decoux
C06869c119472a139eb163b72040b0db?d=identicon&s=25 Bertram Scharpf (Guest)
on 2007-01-11 09:12
(Received via mailing list)
Hi Guy,

Am Dienstag, 09. Jan 2007, 23:58:18 +0900 schrieb ts:
> >>>>> "B" == Bertram Scharpf <lists@bertram-scharpf.de> writes:
>
> B> This yields in an "ERROR: Insecure operation - require". At
>
>  By default, plruby run with $SAFE = 12

Of course, I do not want to change this. So, I will extend
the local package.

The class I wrote was a small checksum algorithm for 'check'
constraints. Maybe I wil make it subject to an extension
proposal sometimes.

Thanks.

Bertram
This topic is locked and can not be replied to.