Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 53027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:59:57+00:00 2026-05-10T16:59:57+00:00

I want to be able to run unstrusted ruby code. I want to be

  • 0

I want to be able to run unstrusted ruby code. I want to be able to pass variables to said untrusted code that it may use. I also want said code to return a result to me. Here is a conceptual example of what I am thinking

input = 'sweet' output = nil Thread.start {    $SAFE = 4    #... untrusted code goes here, it uses the input variable(s)    #to calculate some result that it places in the output variable } #parse the output variable as a string. 

Just to clarify, I am basically using the untrusted code as a function. I want to provide its some inputs, and then allow it to write to the output. That is all I really want, I don’t care how it is done, I just want the ability to use untrusted Ruby code as a sort of function. The solution does not have to look anything like the code I wrote above, I am just using it to illustrate what I want.

Now, I can currently think of 3 ways to do this:

  1. Use the $SAFE level construct above.
  2. whytheluckystiff has a Sandbox plugin for ruby
  3. I could run each function in its own virtual machine, using some sort of os virtualization software like vmware or Xen or something.

I am wondering if anyone has any recommendations for running untrusted ruby code in a functional way? What option would you recomend? How would you go about it? Thanks.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:59:57+00:00Added an answer on May 10, 2026 at 4:59 pm

    $SAFE is not enough; you need to be at least at the level of Why’s freaky sandbox. However, I don’t know if that sandbox code is actively maintained or if he/they ever solved the holes such as infinite loops, etc.

    Unsafe generally means hostile. If you can relax from hostile to, say, ‘naive’, and depending upon the requirements of your app, you might get away with sandboxing in Ruby. It’s not really a first-class scenario in the language design.

    Even with that, though, you probably don’t need to go to the machine level of separation. I’d feel pretty safe using a sandbox in a separately spawned process, with your app functioning as a process manager to kill off any that manage to hang/flame. Now, that is a few orders of magnitude more work than your simple block above.

    But remember and keep repeating, ‘SAFE can’t deal with hostile’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to run a program through command line and I
As part of our build process, we want to be able to run a
Quite simply I want to be able to test that a Asp.Net web forms
I am creating generic reporting logic for my application and want to be able
I installed maven plugin for eclipse and was able to use it only in
I have a JAR with 4 classes, each one has Main method. I want
I am working on an application to automate testing for SQL injection vulnerability. It
I wanted to work with Subversion in Java. The most important thing for me
My usual workflow when working with git, is something like this: create a local
I have 11g installed locally on my machine (Windows 7 64bit). When I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.