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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8: Code Access <strong>Security</strong> in Practice 187The steps shown in Figure 8.1 are summarized below.1. An assembly is loaded.This operation is performed by an application domain host. On a <strong>Web</strong> serverloading a <strong>Web</strong> application assembly, this is the ASP.NET host.2. Evidence is gathered from the assembly <strong>and</strong> presented by the host.3. Evidence is evaluated against the defined security policy.4. The output from security policy evaluation is one or more named permission setsthat define the permission grant for the assembly.Note An assembly can include permission requests, which can further reduce thepermission grant.5. Code within the assembly dem<strong>and</strong>s an appropriate permission prior to accessing arestricted resource or performing a privileged operation.All of the .NET Framework base classes that access resources or performprivileged operations contain the appropriate permission dem<strong>and</strong>s. For example,the FileStream class dem<strong>and</strong>s the FileIOPermission, the Registry class dem<strong>and</strong>sthe RegistryPermission, <strong>and</strong> so on.6. If the assembly (<strong>and</strong> its callers) have been granted the dem<strong>and</strong>ed permission, theoperation is allowed to proceed. Otherwise, a security exception is generated.How Is Policy Evaluated?When evidence is run through the policy engine, the output is a permission set thatdefines the set of permissions granted to an assembly. The policy grant is calculatedat each level in the policy hierarchy: Enterprise, Machine, User, <strong>and</strong> <strong>Application</strong>Domain. The policy grant resulting from each level is then combined using anintersection operation to yield the final policy grant. An intersection is used to ensurethat policy lower down in the hierarchy cannot add permissions that were notgranted by a higher level. This prevents an individual user or application domainfrom granting additional permissions that are not granted by the Enterpriseadministrator.

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

Saved successfully!

Ooh no, something went wrong!