> ## Content Index
> Fetch the complete content index at: https://www.agentsecbrief.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# What is a Content Security Policy (CSP)?
- URL: https://www.agentsecbrief.com/what-is-a-content-security-policy-csp/
- Published: 2026-11-20T17:20:14.000Z
- Updated: 2026-11-20T17:20:14.000Z
- Description: A Content Security Policy is a set of rules a website sends to browsers listing which sources of scripts, connections and other content the page may load, so the browser blocks anything else.
- Author: Angela Milash
- Tags: Supply Chain, Data Exfiltration, Glossary

## What is a Content Security Policy (CSP)?

A Content Security Policy is a set of rules a website sends to browsers listing which sources of scripts, connections and other content the page may load, so the browser blocks anything else.

### Why it matters

Modern sites load code from many vendors, and attackers who change a vendor's script can steal card numbers or session cookies from every site that uses it. A strict CSP limits where scripts can come from and where data can be sent, and its violation reports warn you when something unexpected runs.

### Example

On 16 November 2026 an attacker wrote malicious JavaScript into Optimizely customer projects, served from Optimizely's own CDN to 178 organizations' sites, skimming card data and swapping crypto wallet addresses ([Report URI](https://blog.report-uri.com/worlds-largest-brands-infected-with-malware-via-optimizely/?ref=agentsecbrief.com)).

### How to defend against it

- Set a restrictive script-src and connect-src that list only the domains you need.
- Turn on CSP violation reporting and alert on new blocked sources.
- Mark session cookies HttpOnly so scripts cannot read them.
- Monitor third-party scripts for content changes, not just availability.

### Related terms

Supply chain attack, Magecart skimming, subresource integrity

### Sources

- [W3C Content Security Policy Level 3](https://www.w3.org/TR/CSP3/?ref=agentsecbrief.com)
- [Report URI: Optimizely incident](https://blog.report-uri.com/worlds-largest-brands-infected-with-malware-via-optimizely/?ref=agentsecbrief.com)

*From AgentSec Brief, the daily brief on securing agentic AI. Subscribe free at https://www.agentsecbrief.com*