liveBook · Manning

Content-Security-Policy

Also called CSP

Content Security Policy is a web security standard that lets a site specify browser-enforced rules restricting the sources and forms of content a document may load or execute.

How 2 Manning books explain it

Building Web APIs with ASP.NET Core

A content security policy is a browser-enforced security policy that restricts the sources and forms of content a web page may load or execute.

How it is used
Protects a deployed web API by restricting content browsers load or execute.
How deep it goes
Shows middleware configuration and a nonce-based exception, but defers detailed treatment of security-header settings.
Examples
Tests a deployed /cod/test endpoint, inspects a browser-console violation, and updates the policy and script with a matching nonce.
What you can do after
Operate/configure it in ASP.NET Core middleware and diagnose a blocked inline script with the browser console.

Read how Building Web APIs with ASP.NET Core explains Content-Security-Policy →

Grokking Web Application Security

A content security policy is a web security standard that specifies permitted sources and execution rules for resources loaded by a web page.

How it is used
Limits permitted resource loading and framing to reduce XSS and clickjacking risk.
How deep it goes
Explains header and meta delivery, source directives, inline-script tradeoffs, and framing rules without browser internals.
Examples
Uses Express and meta-tag policies, an injected comment script, and frame-ancestors policy variants.
What you can do after
Apply it via HTTP headers or meta tags to restrict resources, block inline scripts, and control framing.

Read how Grokking Web Application Security explains Content-Security-Policy →

Also covered in

What to know first

Related concepts

Questions about Content-Security-Policy

What is Content-Security-Policy?

Content Security Policy is a web security standard that lets a site specify browser-enforced rules restricting the sources and forms of content a document may load or execute.

Which Manning books explain Content-Security-Policy?

Building Web APIs with ASP.NET Core and Grokking Web Application Security.

What should I know before learning Content-Security-Policy?

Manning books that teach Content-Security-Policy usually introduce cross-site scripting attack and inline JavaScript first.

What are the parts of Content-Security-Policy?

Content-Security-Policy includes frame-ancestors directive.

What is Content-Security-Policy also called?

Content-Security-Policy is also called CSP.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.