I'm making a piece of rendering software and I want to make the tools it encompasses extensible. I've built a UI that lets the user write custom C# functions for blending values. The functions (and accompanying values/constants) are added to a class and compiled using CodeDom, and the blend function is used from there. The functions must take the signature:
public float Blend(float baseValue, float value);
The trouble I'm having is that someone could very easily write a script that does all manner of malicious stuff. They know that this blend function is the entry point, but they could put any kind of code in there. Is there any way to restrict what assemblies are available to the CodeDom compiler? For example could I blacklist or whitelist certain assemblies? Could I prevent the script from accessing System.IO for example?
Regards and thanks in advance.