Chapter 9: Securing Node.js Applications
Throughout this book, we've learned how we can use Node.js to build applications. But as with all software, you must take certain precautions to ensure the application you're building is secure.
You should first ensure that you've adopted any Node.js releases that contain security fixes. For this reason, you should aim, where possible, to be on the latest release of a given Node.js release line.
This chapter will cover some of the key aspects of Node.js web application security. The later recipes demonstrate some of the common attacks on web applications, including Cross-Site Scripting (XSS) and Cross-Site Request Forgery (CSRF) attacks. The recipes will showcase how to prevent and mitigate the risk of some of these attacks.
This chapter will cover the following recipes:
- Detecting known dependency vulnerabilities
- Authentication with Express.js
- Setting HTTP headers with Helmet
- Protecting against HTTP...