开发者

Preventing filesystem access and other destructive actions

开发者 https://www.devze.com 2023-03-31 17:10 出处:网络
I would li开发者_如何转开发ke to create a small Rails application that would allow users to give a few snippets of code to benchmark in multiple implementations and versions of Ruby. I am capable of c

I would li开发者_如何转开发ke to create a small Rails application that would allow users to give a few snippets of code to benchmark in multiple implementations and versions of Ruby. I am capable of creating the application, I am just afraid of users mucking around in the filesystem or doing other destructive actions. Is there any way to prevent this?


There is $SAFE:

The variable $SAFE determines Ruby's level of paranoia.

The various "safety levels" are noted at the link, there's also some examples (which still work) of using a thread, $SAFE, and load to wrap untrusted code. $SAFE on ruby might be worth a look as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消