Content Security Policy
security
A Content Security Policy tells browsers which sources of scripts, styles and frames are legitimate, sharply reducing what injected code can do. It is a defence-in-depth layer on top of input validation.
Start in report-only mode, watch violations, then enforce gradually.
A CSP header neutralised a stored-XSS attempt by refusing inline scripts from unapproved origins.
Related topics
Frequently asked question
What is Content Security Policy?
A Content Security Policy tells browsers which sources of scripts, styles and frames are legitimate, sharply reducing what injected code can do. It is a defence-in-depth layer on top of input validation. Start in report-only mode, watch violations, then enforce gradually.
Read the full answer