How to securely embed the F# compiler in a asp.net web app

时间:2016-04-25 09:42:28

标签: f# f#-interactive f#-compiler-services

I am developing a asp.net web app enabling users to submit F# code, which should be dynamically compiled and executed on the server. I was thinking of either hosting the F# compiler in the web app using the approach shown here: https://fsharp.github.io/FSharp.Compiler.Service/compiler.html Or use F# interactive: http://fsharp.github.io/FSharp.Compiler.Service/interactive.html

The idea would be to dynamically compile the F# code and then load it as an assembly in c# or have F# interactive interpret the code. However, my main concern is security and how to stop the end user from executing arbitrary code. Is there an easy way to restrict this? Thanks!

1 个答案:

答案 0 :(得分:0)

这是一个古老的问题,自被问起以来,情况已经发生了很大变化。现在,寓言团队已设法在Web工作者内部运行F#编译器,从而无需在服务器端执行代码。这回避了执行不可信代码的所有安全问题。

  • 您可以尝试REPL here
  • 您可以查看源代码here
相关问题