Improving the security of our applications
The tools and techniques that we are going to explore in this section are evolving very quickly, so I suggest you keep an eye on the Node.js Security Working Group (https://github.com/nodejs/security-wg) and the community to be aware of the latest trends. However, here is a solid checklist that you can use to improve the security of your applications:
- Encrypt: As we saw in Chapter 13, encryption is the backbone of security in the modern internet. We need to encrypt the data in transit and at rest. Also, we need to think about encrypting sensitive data in the database so we can reduce the risk of a data breach. As an example, in Chapter 13, we used the
bcrypt
library (https://www.npmjs.com/package/bcrypt) to encrypt the user’s password in our project:userSchema.pre('save', async function (next) { const user = this if (user.isModified('password')) { const salt...