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 9: Using Code Access <strong>Security</strong> with ASP.NET 2374. Install the wrapper assembly in the GAC.This gives full trust to the wrapper, but not the <strong>Web</strong> application. The ASP.NETpolicy files contain the following code group, which grants full trust to anyassembly located in the GAC:Note Default enterprise <strong>and</strong> local machine policy also grant full trust to any code located in theMy Computer zone, which includes code installed in the GAC. This is important because grantedpermissions are intersected across policy levels.5. Configure the <strong>Web</strong> application trust level (for example, set it to “Medium”).Figure 9.2 shows the s<strong>and</strong>boxing approach.Dem<strong>and</strong> thenAssertPartial Trust<strong>Web</strong><strong>Application</strong>WrapperAssembly(Strong Namedin the GAC)ResourceAccessSecuredResourceS<strong>and</strong>boxed CodeFigure 9.2S<strong>and</strong>boxing privileged code in its own assembly, which asserts the relevant permissionIt is good practice to use separate assemblies to encapsulate resource access <strong>and</strong>avoid placing resource access code in .aspx files or code behind files. For example,create a separate data access assembly to encapsulate database access. This makes iteasier to migrate applications to partial-trust environments.

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

Saved successfully!

Ooh no, something went wrong!