Content Security Policy is a security header that helps prevent cross-site scripting (XSS) attacks by controlling which resources browsers are allowed to load for a…