lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello ingmar,

Tuesday, January 19, 2010, 8:07:23 PM, you wrote:

>>        function sandboxed_function()
>>                print "hello, world!"
>>        end

> But when i permit the user to modifie the ai, he could simply remove the line

>     setfenv(sandboxed_function, { print = print })

here body of sandboxed_function should be considered as example of
script written by user. 
it can define functions and call functions provided in fenv, but
nothing more. it's the whole idea - you give user access only to some
set of functions. if you don't include here functions that load
external C libraries or directly modify memory, then it's impossible
to run out of your sandbox. everything that user can do is to call
provided functions with some arguments


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin@gmail.com