Overview of Partial Trust
Most common security mechanisms give rights to users based on their logon credentials (usually a password) and restrict resources such as directories and files that the users can access. However, this approach fails to address several issues: users obtain code from many sources, some of which might be unreliable; code can contain bugs or vulnerabilities that enable it to be exploited by malicious code.
To help protect computer systems from malicious mobile code, to allow code from unknown origins to run with protection, and to help prevent trusted code from intentionally or accidentally compromising security, the .NET Framework provides a security mechanism named code access security. Code access security allows code to be trusted to varying degrees depending on where the code originates and on other aspects of the code's identity. Code access security also enforces the varying levels of trust on code, which minimizes the amount of code that must be fully trusted in order to run. The security policy defines the level of trust and there are five default trust policies that you can assign to applications. These policies are named full, high, medium, low, and minimal. If an application has full security, code access security imposes no restrictions. Partial-trust policies impose various sets of constraints, such as restricting an application from accessing the local hard disk and from running unmanaged code.
If your application needs more permissions than those granted in a default trust level, such as medium trust, but you do not want to run in full trust, you can create a custom policy based on a default policy that grants the specific additional permissions that you need. For example, if you want to run in medium trust but you must grant your application read-only access to a directory on the user's file system, you can create a custom policy based on medium trust that also requests FileIOPermission for only that directory.
Used correctly, this approach increases the functionality of your application while minimizing security risks to your users. Most of the web host providers that provide shared hosting use different flavors of the medium trust policy, so as it turns out this a common scenario for a lot of small or mid-range web applications out there.
Partial Trust and the O/R domain
After a thorough research it turned out that most O/R products do not support the partial trust paradigm out of the box. Yes, vendors and communities claimed partial trust support, but most commonly the support was tied to severe limitations of the products functionality or even more – re-writing or changing parts of the source code of the product. Also the most popular products like Linq To Sql and Entity Framework had issues on their own with the partial trust support.
Partial Trust and the Telerik OpenAccess ORM
This was a clear message to us that the problem is severe and stays improperly addressed by the industry as a whole – so we brought a solution in the best ways we do at Telerik – simple, easy, with a click of a button:
That makes us really proud, because as far as we know no one else solved the riddle in such an elegant manner. Starting from our previous release Q1 2009 of the Telerik OpenAccess ORM, we introduced a very solid support for partial trust. It was bullet-proofed with real tests against some of the most popular web hosting providers out there. Of course, having in mind the great variety of providers and security flavors applied, we had no chance to test it against all hosting providers, but there is the moment our well-known customer support comes into place – we never left a single customer with his problems unresolved.
Subscribe to be the first to get our expert-written articles and tutorials for developers!