Summary
In this chapter, we've covered an extremely important topic, application security. Thanks to the hard work of the Node.js and Express communities, we've been able to tighten the security simply by adding a few bits of code here and there to configure security modules. We've even worked out how to prevent the system from being built, if it's using packages with known vulnerabilities.
Enabling HTTPS means our users have better assurance of security. The SSL certificate is a measure of authenticity that protects against man-in-the-middle security attacks, and the data is encrypted for transmission across the internet. With a little bit of work, we were able to set up a system to acquire, and continuously renew, free SSL certificates from the Let's Encrypt service.
The helmet
package provides a suite of tools to set security headers that instruct web browsers on how to treat our content. These settings prevent or mitigate whole classes of security bugs. With the csurf
package, we're able...