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 7: Building Secure Assemblies 151Identify Privileged ResourcesIdentify the types of resources your assembly needs to access; this allows you toidentify any potential problems that are likely to occur if the environment yourassembly ultimately runs in does not grant the relevant code access securitypermissions. In this case you are forced either to update code access security policyfor your application if the administrator allows this, or you must s<strong>and</strong>box yourprivileged code. For more information about s<strong>and</strong>boxing, see Chapter 9, “Using CodeAccess <strong>Security</strong> with ASP.NET.”Identify Privileged OperationsAlso identify any privileged operations that your assembly needs to perform, againso that you know which code access permissions your code requires at runtime.Identify the Trust Level of Your Target EnvironmentThe target environment that your assembly is installed in is important because codeaccess security policy may constrain what your assembly is allowed to do. If, forexample, your assembly depends on the use of OLE DB, it will fail in anything lessthan a full trust environment.Full Trust EnvironmentsFull trust means that code has an unrestricted set of code access security permissions,which allows the code to access all resource types <strong>and</strong> perform privileged operations,subject to operating system security. A full trust environment is the defaultenvironment for a <strong>Web</strong> application <strong>and</strong> supporting assemblies installed on a <strong>Web</strong>server, although this can be altered by configuring the element of theapplication.Partial Trust EnvironmentA partial trust environment is anything less than full trust. The .NET Framework hasseveral predefined trust levels that you can use directly or customize to meet yourspecific security requirements. The trust level may also be diminished by the origin ofthe code. For example, code on a network share is trusted less than code on the localcomputer <strong>and</strong> as a result is limited in its ability to perform privileged operations.

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

Saved successfully!

Ooh no, something went wrong!