What CSP does
Content-Security-Policy tells the browser which sources may load scripts, styles, images and connections for your page. If an attacker manages to inject a script tag, a good policy stops the browser from running it, which makes cross-site scripting much harder to exploit.