safe domain specific language implementation

Discussion in 'Ruby' started by John Miller, Sep 8, 2006.

  1. John Miller

    John Miller Guest

    Greeting All,

    I am trying to write code that will interpret user submitted scripts in
    a secure way. I have a limited set of functions that they should be
    able to call to change various states. I also need the usual branching,
    loping, and local variable assignment types of things. (see example
    code) I hoped to be able to use Ruby’s safe mode for this is ways
    similar to http://www.artima.com/rubycs/articles/ruby_as_dslP.html

    I have a few questions in this regard:

    1). Are there any websites/articles that deal with how to use $SAFE
    (particularly level 4)

    2). In light of http://code.whytheluckystiff.net/sandbox/wiki is this a
    feature that is still in development? (please also see
    http://www.ruby-forum.com/topic/79295#131045)

    3). What are some implementation options? What would be required in
    terms of programming?

    Thanks

    J.F. Miller


    =====
    Example code

    #entrusted user script

    #call this function when a power shortage is detected
    def power_shortfall
    pl = get_power_reading
    if pl<100
    shutdown_expermint
    else
    reduse_load(1000-pl/10)
    end
    end

    --
    Posted via http://www.ruby-forum.com/.
     
    John Miller, Sep 8, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    155
    Michael Neumann
    Feb 16, 2005
  2. Joe Van Dyk

    domain-specific language

    Joe Van Dyk, Aug 18, 2005, in forum: Ruby
    Replies:
    10
    Views:
    459
    Joe Van Dyk
    Sep 7, 2005
  3. Replies:
    1
    Views:
    204
    James Britt
    Oct 31, 2005
  4. Rustem Zhunusov

    Ruby 2.0 and Domain-Specific language

    Rustem Zhunusov, Feb 14, 2008, in forum: Ruby
    Replies:
    2
    Views:
    126
    Etienne Vallette d'Osia
    Feb 14, 2008
  5. Zd Yu
    Replies:
    6
    Views:
    118
    Brian Candler
    Dec 20, 2010
Loading...

Share This Page