限制对Rails中用户提交的代码的访问

编程入门 行业动态 更新时间:2024-10-21 11:39:15
本文介绍了限制对Rails中用户提交的代码的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个将ruby代码作为输入并执行它的Rails应用程序.由于提交的代码来自不受信任的域,因此我想限制对某些方法和模块的访问.例如,我不希望用户访问File.read或open().

I'm working on a rails application that takes ruby code as input and executes it. Since the code submitted comes from an untrusted domain, I want to restrict access to certain methods and modules. For example, I don't want users to access File.read or open().

还可以将访问权限限制为仅几个模块吗?用户提交的代码中仅需要白名单中的模块.

Also, is it possible to restrict access to only a few modules? Only modules from a whitelist can be required from user submitted code.

我可能可以对用户代码进行验证,但是我想检查ruby语言或任何模块是否已经具有此功能.

I can probably do a validation on the user code, but I wanted to check if ruby language or any modules already have this capability.

Codeschool有交互式教程.我想知道他们是否限制访问用户代码或进行任何验证.

Codeschool has interactive tutorials. I am wondering if they restrict access to user code or do any validation at all.

推荐答案

我一直使用 shikashi 对这种任务感到满意.

I've always used shikashi with satisfaction for this kind of tasks.

更多推荐

限制对Rails中用户提交的代码的访问

本文发布于:2023-10-24 19:53:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524848.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   用户   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!