How To Secure Node.js Applications with a Content Security Policy
A CSP is an HTTP header that provides an extra layer of security against code-injection attacks, such as cross-site scripting (XSS), clickjacking, and other similar exploits. It facilitates the creation of an “allowlist” of trusted content and blocks the execution of code from sources not present in the allowlist. In this tutorial, you’ll review the different protections the CSP header offers by implementing one in a Node.js application. You’ll also collect JSON reports of CSP violations.