What are some recommended libraries for securing code

Question

What third-party libraries and frameworks are available to help secure my application?

Answer

The VA Software Assurance Program Office generally provides architectural recommendations for the use of third-party security libraries, frameworks, and potentially VA infrastructure services as they are identified during ATO code review checks. The purpose of this note is to provide some additional recommendations outside of our reports. Our office does not generally require the use of any particular third-party library or framework for securing applications. There are many libraries, frameworks, and built-in programming language features available to help secure applications.

No one library provides all the protections an application may require, so often a set of libraries are required to provide a full set of features. The use of a security library or framework does not necessarily mean the application is secure. It must be used correctly in the context of the application. For example, sanitizing data for cross-site scripting does not make it safe to write to a log file. This technical note provides some suggested tools and the security services that they provide.

The table below is organized according to security services provided:

Programming Language Third-Party Library/Framework Data Validation, Sanitation, or Encoding CSRF Protections Secure Replacement APIs XML/Schema Protections Session Management Notes
Java/JSP, JavaScript OWASP ESAPI yes yes
PHP HTML Purifier yes Sanitizes HTML text
Java Apache CXF Framework yes
Java Spring Security yes yes
Java OWASP AntiSamy yes Sanitizes HTML & CSS text
Java OWASP CSRFGuard yes
Java Apache Commons Validator yes
Java OWASP Java Encoder warninges OWASP considers this an incubator project
Java OWASP HTML Sanitizer warning OWASP considers this an incubator project
PHP OWASP CSRFProtector warning OWASP considers this an incubator project
.NET HtmlSanitizer yes Sanitizes HTML text
JavaScript Google htmlsanitizer.js yes Sanitizes HTML text
JavaScript DOMPurify yes Sanitizes HTML text
Python Bleach yes Sanitizes HTML text
Java SerialKiller yes Java serialized data
Java OWASP Stinger no

It is not recommended to use this third-party library.

For more information, please see CVE-2007-4385