ironpython - .NET DLR safe or sandboxed script -
i using dlr within small part of larger c# project, ironpython being language in question.
for parts of system user able enter small script customise behaviour them. able restrict them using side-effect free pure functions or in sort of sandbox function cannot touch outside.
also, user can enter function body, function header , argument specification automatically pre-pended in code before being passed python dlr engine c# side of system calls knows args pass , coming back. users ever require simple operations , tests based purely on values supplied arguments.
e.g.
this ok: return (a * 100) > b;
this not ok: delete_file_system(); return (a * 100) > b;
how might achieved? there more appropriate language or technology choice?
the way create sandboxed app domain , run script in app domain. can find directions on creating sandboxed domain here: http://msdn.microsoft.com/en-us/library/bb763046.aspx
to run code in app domain can use python.createengine overload accepts appdomain. of code executed in engine run in app domain.
if want have user code call host can create class derives marshalbyrefobject , put in scope them access , call back. calls go through normal app domain , can you'd able do.
there's bunch of apis on objectoperations , scriptscope classes work objecthandles performing operations on objects in remote domain.
Comments
Post a Comment