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.

396 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sCode Access <strong>Security</strong> ConsiderationsAll data access is subject to code access security permission dem<strong>and</strong>s. Your chosenADO.NET managed data provider determines the precise requirements. Thefollowing table shows the permissions that must be granted to your data accessassemblies for each ADO.NET data provider.Table 14.1 Code Access <strong>Security</strong> Permissions Required by ADO.NET Data ProvidersADO.NET Data ProviderSQL ServerRequired Code Access <strong>Security</strong> PermissionSqlClientPermissionSupports partial trust callers including Medium trust <strong>Web</strong>applications.OLE DBOracleODBCOleDbPermission*OraclePermission*OdbcPermission**At the time of writing, the OLE DB, Oracle, <strong>and</strong> ODBC providers support only Full trust callers on versions 1.0<strong>and</strong> 1.1 of the .NET Framework. To use these providers from partial trust <strong>Web</strong> applications, you must s<strong>and</strong>boxyour data access code, which necessitates a dedicated data access assembly. For an example that shows how tos<strong>and</strong>box data access code <strong>and</strong> use the OLE DB data provider from a Medium trust <strong>Web</strong> application seeChapter 9, “Using Code Access <strong>Security</strong> with ASP.NET.”If you use the ADO.NET SQL Server data provider, your code must be granted theSqlClientPermission by code access security policy. Full <strong>and</strong> Medium trust <strong>Web</strong>applications have this permission.Whether or not code is granted the SqlClientPermission determines whether or notthe code can connect to SQL Servers. You can also use the permission to placerestrictions on the use of database connection strings. For example, you can force anapplication to use integrated security or you can ensure that if SQL Server securityis used then blank passwords are not accepted. Violations of the rules you specifythrough the SqlClientPermission result in runtime security exceptions.For more information about how to use SqlClientPermission to constrain dataaccess, see “Data Access” in Chapter 8, “Code Access <strong>Security</strong> in Practice.”

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

Saved successfully!

Ooh no, something went wrong!