====== Ubuntu - CSP (Content Security Policy) ====== The **Content-Security-Policy** HTTP response header helps you reduce XSS risks on modern browsers by declaring what dynamic resources are allowed to load via a HTTP Header. **NOTE**: It is known that having both **Content-Security-Policy** and **X-Content-Security-Policy** or **X-Webkit-CSP** causes unexpected behaviours on certain versions of browsers. Please avoid using deprecated **X-*** headers. ---- ===== Directive Reference ===== The Content-Security-Policy header value is made up of one or more directives (defined below), multiple directives are separated with a semicolon ; ^Directive^Example Value^Description^ |default-src|'self' cdn.example.com|The default-src is the default policy for loading content such as JavaScript, Images, CSS, Font's, AJAX requests, Frames, HTML5 Media. See the Source List Reference for possible values.| |script-src|'self' js.example.com|Defines valid sources of JavaScript.| |style-src|'self' css.example.com|Defines valid sources of stylesheets.| |img-src|'self' img.example.com|Defines valid sources of images.| |connect-src|'self'|Applies to XMLHttpRequest (AJAX), WebSocket or EventSource. If not allowed the browser emulates a 400 HTTP status code.| |font-src|font.example.com|Defines valid sources of fonts.| |object-src|'self'|Defines valid sources of plugins, e.g. , or .| |media-src|media.example.com|Defines valid sources of audio and video, e.g. HTML5 , elements.| |frame-src|'self'|[DEPRECIATED]Defines valid sources for loading frames. child-src is preferred over this deprecated directive.| |sandbox|allow-forms allow-scripts|Enables a sandbox for the requested resource similar to the iframe sandbox attribute. The sandbox applies a same origin policy, prevents popups, plugins and script execution is blocked. You can keep the sandbox value empty to keep all restrictions in place, or add values: allow-forms allow-same-origin allow-scripts allow-popups, allow-modals, allow-orientation-lock, allow-pointer-lock, allow-presentation, allow-popups-to-escape-sandbox, and allow-top-navigation.| |report-uri|/some-report-uri|Instructs the browser to POST a reports of policy failures to this URI. You can also append -Report-Only to the HTTP header name to instruct the browser to only send reports (does not block anything).| |child-src|'self'|Defines valid sources for web workers and nested browsing contexts loaded using elements such as and