Content Security Policy
Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft, to site defacement, to malware distribution.
To enable CSP, you need to configure your web server to return the Content-Security-Policy
HTTP header. (Sometimes you may see mentions of the X-Content-Security-Polic
y header, but that's an older version and you don't need to specify it anymore.)
Alternatively, the <meta> element can be used to configure a policy, for example:
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; img-src https://*; child-src 'none';" />