i wrote a Plugin system and the Plugin Host need to know which 'usings' each module has.
The main idea is limit what the plugin can use in the code, to evaluate it's security level. Exemple: the plugins can't manipulate Disk or Networking, then i'm thinking in limit by 'usings' or loaded dlls.
I seached how to get the 'Loaded Modules' of plugin, but i don't found the reference of System.IO or any dll that could help.
Then i look into assembly.Get***() (modules/fields/...)
maybe an axemple could help: Plugin 'A' EntryPoint.cs
using System.Collections.Generic; <--- is allowed
using System.IO; <--- it is not allowed
using System.Net; <--- it is not allowed
.... Declare a namsespace, classes and other... AND i used a streamwriter
i need to know if the plugin is using System.Net, or other prohibited reference.
Thanks (a lot for ALL possibilities)
Edit: 1) Assembly.GetReferencedAssemblies don't work, some DLLs has Allowed and Prohibeted references
2) The Disk/Network access could be done using some 'help libraries' that manages this access.
3) for Sandbox solution: i saw this, but the major question is that i have something like a virtual disk, and when user ask to list a directory, this operation will ask a server 'what files this user has in this folder?' then this server will collect all files in a database and return this list. When a file must be readed/writed this modifications need to sync. with all other computers that can read this file. A Network operation is a specific to a range of 'virtual parteners' but without a complete VPN solution.