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.

234 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sTable 9.3 Default ASP.NET Policy Permissions <strong>and</strong> Trust Levels (continued)Permission <strong>and</strong> State High Medium Low Minimal<strong>Security</strong>PermissionUnrestrictedAssertionExecutionControlThreadControlPrinicipalRemotingConfigurationSocketPermissionUnrestrictedSqlClientPermissionUnrestricted <strong>Web</strong>PermissionUnrestricted $OriginHost$Approaches for Partial Trust <strong>Web</strong> <strong>Application</strong>sIf you develop a partial-trust application or enable an existing application to run at apartial-trust level, <strong>and</strong> you run into problems because your application is trying toaccess resources for which the relevant permissions have not been granted, you canuse two basic approaches:● Customize policyCustomize policy to grant the required permissions to your application. Thismight not be possible, for example in hosting environments, where policyrestrictions are rigid.● S<strong>and</strong>box privileged codePlace resource access code in a wrapper assembly, grant the wrapper assembly fulltrust (not the <strong>Web</strong> application), <strong>and</strong> s<strong>and</strong>box the permission requirements ofprivileged code.The right approach depends on what the problem is. If the problem is related to thefact that you are trying to call a system assembly that does not containAllowPartiallyTrustedCallersAttribute, the problem becomes how to give a piece ofcode full trust. In this scenario, you should use the s<strong>and</strong>boxing approach <strong>and</strong> grantthe s<strong>and</strong>boxed wrapper assembly full trust.Note Customizing policy is the easier of the two approaches because it does not require anydevelopment effort.

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

Saved successfully!

Ooh no, something went wrong!