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.

Chapter 8: Code Access <strong>Security</strong> in Practice 191APTCAAn assembly that has a strong name cannot be called by a partial trust assembly (anassembly that is not granted full trust), unless the strong named assembly containsAllowPartiallyTrustedCallersAttribute (APTCA) as follows:[assembly: AllowPartiallyTrustedCallersAttribute()]This is a risk mitigation strategy designed to ensure your code cannot inadvertentlybe exposed to partial trust (potentially malicious) code. The common languageruntime silently adds a link dem<strong>and</strong> for the FullTrust permission set to all publiclyaccessible members on types in a strong named assembly. If you include APTCA, yousuppress this link dem<strong>and</strong>.Avoid Using APTCAIf you use APTCA, your code is immediately more vulnerable to attack <strong>and</strong>, as aresult, it is particularly important to review your code for security vulnerabilities. UseAPTCA only where it is strictly necessary.In the context of server-side <strong>Web</strong> applications, use APTCA whenever your assemblyneeds to support partial trust callers. This situation can occur in the followingcircumstances:● Your assembly is to be called by a partial trust <strong>Web</strong> application. These areapplications for which the level is set to something other than Full. Formore information about partial trust <strong>Web</strong> applications <strong>and</strong> using APTCA in thissituation, see Chapter 9, “Using Code Access <strong>Security</strong> in ASP.NET.”●●●Your assembly is to be called by another assembly that has been granted limitedpermissions by the code access security administrator.Your assembly is to be called by another assembly that refuses specificpermissions by using <strong>Security</strong>Action.RequestRefuse or<strong>Security</strong>Action.RequestOptional. These make the calling assembly a partial trustassembly.Your assembly is to be called by another assembly that uses a stack walk modifier(such as Deny or PermitOnly) to constrain downstream code.

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

Saved successfully!

Ooh no, something went wrong!