CSP tells a browser which resources and behaviors a page may use. Its protection comes from the actual rules, not the presence of the header.
How to read a policy
Content-Security-Policy: default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'
This illustrative policy allows same-origin resources by default, blocks plugin objects, limits the document base URL, and prevents framing. It assumes the page can work with those restrictions; it is not a universal configuration.
Directives are separated by semicolons. 'self' means the page's origin. 'none' permits no sources and should stand alone. A more specific directive, such as script-src, replaces the default-src fallback for that resource type.
Important directives
script-srcandstyle-src: permitted JavaScript and styles.img-src,font-src, andconnect-src: images, fonts, and script connections.object-src: plugin content, commonly disabled.base-uri: permitted base URLs.frame-ancestors: who may embed this page.form-action: permitted form submission destinations.
frame-ancestors, base-uri, and form-action do not inherit default-src. frame-src controls frames the page loads; it does not decide who can frame the page.
Inline scripts and weak allowances
'unsafe-inline' can allow injected inline script when no effective nonce or hash rules supersede it. 'unsafe-eval' enables string-to-code execution. Broad source lists can also weaken protection. Prefer carefully implemented nonces or hashes where inline scripts are necessary; a nonce must be unpredictable and generated afresh for each response.
Enforce or observe
Content-Security-Policy-Report-Only helps test a policy without blocking content. It does not provide the enforcement of Content-Security-Policy. Multiple enforcing policies apply together: adding another policy cannot loosen an existing one.
CSP complements safe coding and output encoding. Start with the CSP deployment guide, or troubleshoot blocked resources.