11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

152 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sSupporting Partial Trust CallersThe risk of a security compromise increases significantly if your assembly supportspartial trust callers (that is, code that you do not fully trust.) Code access security hasadditional safeguards to help mitigate the risk. For additional guidelines that applyto assemblies that support partial trust callers, see Chapter 8, “Code Access <strong>Security</strong>in Practice.” Without additional programming, your code supports partial trustcallers in the following two situations:● Your assembly does not have a strong name.● Your assembly has a strong name <strong>and</strong> includes theAllowPartiallyTrustedCallersAttribute (APTCA) assembly level attribute.Why Worry About the Target Environment?The trust environment that your assembly runs in is important for the followingreasons:● A partial trust assembly can only gain access to a restricted set of resources <strong>and</strong>perform a restricted set of operations, depending upon which code access securitypermissions it is granted by code access security policy.● A partial trust assembly cannot call a strong named assembly unless it includesAllowPartiallyTrustedCallersAttribute.●Other partial trust assemblies may not be able to call your assembly because theydo not have the necessary permissions. The permissions that a calling assemblymust be able to call your assembly are determined by:● The types of resources your assembly accesses● The types of privileged operation your assembly performsS<strong>and</strong>box Highly Privileged CodeTo avoid granting powerful permissions to a whole application just to satisfy theneeds of a few methods that perform privileged operations, s<strong>and</strong>box privileged code<strong>and</strong> put it in a separate assembly. This allows an administrator to configure codeaccess security policy to grant the extended permissions to the code in the specificassembly <strong>and</strong> not to the whole application.For example, if your application needs to call unmanaged code, s<strong>and</strong>box theunmanaged calls in a wrapper assembly, so that an administrator can grant theUnmanagedCodePermission to the wrapper assembly <strong>and</strong> not the wholeapplication.Note S<strong>and</strong>boxing entails using a separate assembly <strong>and</strong> asserting security permissions to preventfull stack walks.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!