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 5846387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:34:10+00:00 2026-05-22T12:34:10+00:00

My Rails app has complicated rules about when a bit of content should be

  • 0

My Rails app has complicated rules about when a bit of content should be displayed on a page or not. I’ve decided to implement this by writing predicates (simple ‘yes/no’ functions) in Ruby and storing them in the db for subsequent eval’ing. It it pretty straightforward.

My main concern is security: if a malicious somebody figures out how to write to the db, they could stick arbitrary Ruby code in the db and then ‘all your base are belong to us‘.

So is it possible to create an ‘sandboxed’ eval, for example, which has all IO operations removed?

  • 1 1 Answer
  • 3 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-22T12:34:11+00:00Added an answer on May 22, 2026 at 12:34 pm

    You might want to check the ‘taint’ method and related stuff. This is a good reference:

    http://ruby-doc.com/docs/ProgrammingRuby/html/taint.html

    Despite that, I can’t advise you enough against storing code and evaluating it, it’s a security risk that should be avoided and most times there’s a simpler way of solving your problems.

    If you need to evaluate complex rules and predicates I’d recommend a rule engine to create a nice DSL. Haven’t used one in ruby but this one looks good to me:

    http://treetop.rubyforge.org/index.html

    Cheers

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

Sidebar

Related Questions

This is a bit complicated but here goes. I have a Rails app that
I have a rails app running on port 3000. The page in question has
I have a ruby on rails app that has a signup page. Different pages
I have a rails app that has picked up a bit of traction, but
I'm trying to work on this Rails app which has the following objectives: /foods/
I'm building a rails app that has a page with a jstree object on
My Rails app has some pages which are SSL-required and others which are SSL-optional.
I have a rails app that has asynchronous processing, and I'm having trouble getting
I have a rails app that has a private component and a public component.
I have a Rails app that has 2 clients -- an iOS app reads/writes

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.