是否可以在“防白痴”环境中托管 .Net DLR?沙箱?

发布于 2024-09-10 03:02:39 字数 1159 浏览 3 评论 0原文

我想以这样一种方式托管动态语言运行时 (DLR),以便在其中运行任意脚本的用户无法关闭该进程?

DLR托管规范描述了如何在单独的应用程序域中托管 DLR。这允许拆除和卸载脚本运行时并通过 CAS 限制某些操作(例如,我可以限制文件系统访问或禁止使用反射)。

但是还有其他方法吗,例如:

  • 限制脚本使用的最大内存量?
  • 限制脚本创建的线程数量?
  • 检测死锁脚本?

我认为使用 为 SQL Server 开发的非托管 .net 托管 API。这是要走的方向吗?是否有针对这种通用 .net 沙箱的开源项目?

以下是我发现的一些可能有用的参考:

I would like to host the Dynamic Language Runtime (DLR) in such a way that users who run arbitrary scripts in it cannot bring the process down?

The DLR hosting spec describes how to host the DLR in a separate ApplicationDomain. This allows to tear down and unload a script runtime and to restrict certain operations through CAS (e.g. I can restrict file system access or disallow use of reflection).

But are there also ways to for example:

  • restrict the maximum amount of memory used by a script?
  • restrict the number of threads created by a script?
  • detect deadlocked scripts?

I think such fine grained control could be possible using the unmanaged .net hosting API that was developed for SQL server. Is this the direction to go? Are there open source projects for this kind of general .net sandboxing?

Here are a few potentially useful references that I found:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄凉少年不暖心 2024-09-17 03:02:39

看看 Terrarium --在这款游戏中,您可以使用 .NET 语言构建自己的自主小动物,并将它们连同描述它们的程序集一起传送到其他联网计算机。目标是让您的小动物接管整个生态系统通过杀死其他一切或通过战略性地管理食物资源。

我记得,任何花费超过 0.n 秒“思考”或 n kb 内存的生物都会被删除。

Have a look at Terrarium -- it's a game where you build your own autonomous critters in a .NET language, and they're teleported to other networked computers along with the assemblies that they're described in. The goal is to have your critter take over the entire ecosystem, either by killing everything else or by strategically managing food resources.

As I recall, any critter that spends more than 0.n seconds "thinking" or n kb of memory gets deleted.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文