C#C
C#2y ago
IceReaper

Safe Plugin Loader - Forbid specific namespaces (and reflection usage)?

Im trying to wire a plugin loader where people can extend the application with custom plugins. To ensure people cannot do evil things in their plugin, i want to explicitly whitelist namespaces people can use. If anything forbidden is used in a plugin .dll, i want to reject loading it.

The loading and unloading part is the easiest thing, but what about the namespace restrictions? Anyone has any idea how i can do that? Also i need to forbid the usage of .GetType or typeof() to get around reflection usage. My idea would be by either hand-parse the .dll, somehow find all namespace or function references, and evaluate this manualy as im unaware of any other method. But maybe there is?
Was this page helpful?