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 14: Building Secure Data Access 375Use Separate Data Access AssembliesIf you have a choice, avoid placing data access logic directly in ASP.NET pages or incode-behind files. There are security, reuse, <strong>and</strong> maintenance advantages to placingdata access logic in a separate assembly <strong>and</strong> implementing a logical data access layerthat is separate from your application business <strong>and</strong> presentation logic.From a security perspective, you can:● Use a strong name for the assembly, which provides tamperproofing.● Use s<strong>and</strong>boxing to isolate your data access code, which is important if your codeneeds to support partial-trust callers — for example, partial-trust <strong>Web</strong> applications.● Use data access methods <strong>and</strong> classes that authorize calling code using codeidentity permission dem<strong>and</strong>s.For defense in depth, perform principal-based authorization using principalpermission dem<strong>and</strong>s in your business components <strong>and</strong> use code identity permissiondem<strong>and</strong>s to authorize the code that calls your data access logic, as shown inFigure 14.2.Principal-BasedAuthorizationThe caller is authorizedbased on rolemembershipCode Identity-BasedAuthorizationThe calling code isauthorized based onidentity evidence<strong>Web</strong> AppBusinessClassesDataAccessClassesAssembly1 Assembly2 Assembly3Presentation Business DataFigure 14.2Separation of presentation, business, <strong>and</strong> data access layersFor more information about authorization for data access code, see the“Authorization” section, later in this chapter.

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

Saved successfully!

Ooh no, something went wrong!