用于C#/ .NET应用程序的沙箱中的脚本语言 [英] Scripting Language in a Sandbox for a C#/.NET Application
问题描述
[这个问题类似于这一个,但我也对沙箱的可能性感兴趣。]
我正在考虑在我的C#/ .NET应用程序中嵌入脚本语言,然后暴露我的一些应用程序的API到脚本。似乎有很多好的选择(Lua,Boo,IronPython等),但是是否有简单的选项限制脚本语言的内置函数被使用?例如,我不希望脚本能够执行I / O,除了通过我明确暴露的API,所以没有打印到控制台,打开文件等。这些脚本语言提供了一个简单的方法来做
您可以将脚本加载到不同的AppDomain中,并控制第二个AppDomain的权限。 b
$ b
此链接应该让您开始:
http://blogs.msdn.com/shawnfa/archive/2005/08/08/449050.aspx
[This question is similar to this one, but I am also interested in the possibility of a sandbox.]
I am considering embedding a scripting language in my C#/.NET application and then exposing some of my application's API to the scripts. There seem to be multiple good options for this (Lua, Boo, IronPython, etc.), but are there easy options for restricting the scripting language's built-in functions from being used? For example, I do not want the scripts to be able to perform I/O except through the API that I explicitly expose, so no printing to the console, opening files, etc. Do any of these scripting languages provide an easy way to do this?
You can load te script into a different AppDomain and control the permissions of the second AppDomain.
This link should get you started:
http://blogs.msdn.com/shawnfa/archive/2005/08/08/449050.aspx
这篇关于用于C#/ .NET应用程序的沙箱中的脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!