CSP directive
One rule inside a Content Security Policy, such as script-src, that lists the allowed sources for one kind of resource.
In more detail
default-src is the fallback for types without their own directive; script-src controls JavaScript and style-src controls CSS. Sources can be origins, nonces, hashes or keywords such as 'self'.
Related terms
- Content Security Policy — An HTTP response header that tells the browser which sources of scripts and other content a page may load, limiting what injected markup can do.
- nonce — A value meant to be used only once, such as a unique number given to a cipher or a random token that marks trusted scripts in a web page.
- allowlist — An allowlist names exactly what is permitted and a denylist names what is forbidden, with everything else allowed.
Taught in
- Content Security Policy (CSP), Trusted Types And XSS Defenses — Frontend Architecture & Web Platform