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 11: Building Secure Serviced Components 3135. The code checks whether or not security is enabled prior to the explicit role check.This is a risk mitigation strategy to ensure that transactions cannot be performed ifthe application security configuration is inadvertently or deliberately disabled byan administrator.Note The IsCallerInRole method always returns “true” if security is disabled.6. Callers must be members of either the Manager or Senior Manager role because ofthe declarative security used on the method. For fine-grained authorization, therole membership of the caller is explicitly checked in code.7. The transaction is audited.8. The audit implementation obtains the identity of the original caller by using the<strong>Security</strong>CallContext object.Code Access <strong>Security</strong> Considerations<strong>Application</strong>s that use serviced components are usually fully trusted <strong>and</strong>, as a result,code access security has limited use to authorize calling code. The calling code shouldconsider the following points:● Unmanaged code permission is required to activate <strong>and</strong> perform cross contextcalls on serviced components.● If the client of a serviced component is an ASP.NET <strong>Web</strong> application, then its trustlevel must be set to “Full” as shown below.●If your <strong>Web</strong> application is configured with a trust level other than “Full,” it doesnot have the unmanaged code permission. In this instance, you must create as<strong>and</strong>boxed wrapper assembly to encapsulate the communication with the servicedcomponent. You must also configure code access security policy to grant thewrapper assembly the unmanaged code permission. For more information aboutthe s<strong>and</strong>boxing technique used to encapsulate high privileged code, see Chapter 9,“Using Code Access <strong>Security</strong> with ASP.NET.”If a reference to a serviced component is passed to untrusted code, methodsdefined on the serviced component cannot be called from the untrusted code.The exception to this rule is with methods than do not require context switching orinterception services <strong>and</strong> do not call members of System.EnterpriseServices. Suchmethods can be called by untrusted code.

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

Saved successfully!

Ooh no, something went wrong!