How can I use CAS in .NET 4 to lock down my MEF extensions?

后端 未结 1 544
一个人的身影
一个人的身影 2021-01-14 11:06

I have an application in .NET 4 that uses MEF for extensibility. My main application has three assemblies: Host, Application and Contracts

相关标签:
1条回答
  • 2021-01-14 11:49

    If your application is running in full trust, then by default your extensions will be running in full trust and be able to do anything they want. It won't matter what the security attributes on them are. To limit what extensions can do, you need to create a sandbox appdomain. You would set your Host and Application as fully trusted in that AppDomain and all other code would only have the permissions you grant it.

    Here's an MSDN article on this topic: How to: Run Partially Trusted Code in a Sandbox

    0 讨论(0)
提交回复
热议问题