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.

642 Part V: Assessing Your <strong>Security</strong>Do You Close Database Connections?Check that your code is not vulnerable to leaving open database connections if, forexample, exceptions occur. Check that the code closes connections inside a finallyblock or that the connection object is constructed inside a C# using statement asshown below. This automatically ensures that it is closed.using ((SqlConnection conn = new SqlConnection(connString))){conn.Open();// Connection will be closed if an exception is generated or if control flow// leaves the scope of the using statement normally.}Summary<strong>Security</strong> code reviews are similar to regular code reviews or inspections except thatthe focus is on the identification of coding flaws that can lead to securityvulnerabilities. The added benefit is that the elimination of security flaws oftenmakes your code more robust.This chapter has shown you how to review managed code for top security issuesincluding XSS, SQL injection, <strong>and</strong> buffer overflows. It has also shown you how toidentify other more subtle flaws that can lead to security vulnerabilities <strong>and</strong>successful attacks.<strong>Security</strong> code reviews are not a panacea. However, they can be very effective <strong>and</strong>should feature as a regular milestone in the development life cycle.Additional ResourceFor more information, see MSDN article, “Securing Coding Guidelines for the .NETFramework,” at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/seccodeguide.asp.

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

Saved successfully!

Ooh no, something went wrong!