views:

27

answers:

1

My application loads a lot of different plugin assemblies. Each plugin can add their own services into the IoC container and can also use all services provided by the main application.

I'm moving from a home brewn security solution to use CAS (PrincipalPermissionAttribute and an own one derived from CodeAccessSecurityAttribute).

Can I prevent the loaded assemblies from changing System.Threading.Thread.CurrentPrincipal (and in that way circumvent my security checks)?

A: 

You'll need to deny SecurityPermission\ControlPrincipal permission to the plugins. This can be done, for example, by loading them in an appdomain which denies this permission to all code that does not possess your strong name signature. See http://blogs.msdn.com/b/shawnfa/archive/2005/08/08/449050.aspx for an example of this approach.

Nicole Calinoiu