Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compile and run third party code snippet in Haskell securely?

userDefinedFunction = "\x -> x*x :: Int"
main = do
    f <- complileFunction userDefinedFunction :: Int -> Int
    let results = map f [1,2,3,4]
    print $ show results

How to do it securely? userDefinedFunction is supposed to be untrusted third-party code. It should be built to fast, optimized code, but should not be able to access system directly.

I suppose it should combine Safe Haskell and System.Eval.Haskell. Are there any projects or tutorials covering this?

like image 586
Vi. Avatar asked Nov 28 '14 16:11

Vi.


1 Answers

There is a wiki page for exactly this use case You could also have a look at lambdabots source code.

like image 148
Jesper Fridefors Avatar answered Oct 12 '22 12:10

Jesper Fridefors