Content Security Policy (CSP) is a security policy mechanism used to reduce security vulnerabilities in web applications and to prevent malicious attacks. CSP is used to control and limit the content executed by the browser on the web page. The main purpose of CSP is to prevent or limit attacks like XSS (Cross-Site Scripting).