# Content Security Policy

> For the complete site index, see [llms.txt](/llms.txt). Every page is also available as Markdown: replace the trailing slash with `.md` (`/pricing/` becomes `/pricing.md`), or send `Accept: text/markdown` to the page URL itself.

Explore the robust protection of websites against common vulnerabilities through the implementation of Content Security Policy

---

**Categories:** Consent Management, Features Documentation
**Last updated:** June 2, 2025
**URL:** https://www.cookieyes.com/documentation/content-security-policy/

---

## What is Content Security Policy?

Content Security Policy (CSP) is a security feature websites use to protect against common web vulnerabilities and attacks such as cross-site scripting (XSS) and data injection. CSP works by setting up a policy determining which content sources or types can load or execute on a webpage. It can restrict the loading of external resources so that they only come from trusted sources.  It can also control how inline scripts or event handlers can run. 

## Implementation

CSP is implemented by defining an HTTP header containing a set of rules or directives, instructing the browser on handling different types of content and resources on the webpage. 
To implement Cookieyes with CSP, you can set “`*.cookieyes.com`”  and  “`cdn.cookieyes.com`” as authorised domains/sub-domains; we also support the following directives.


| Directive | Allowed Sources / Value |
| --- | --- |
| default-src | 'none' |
| script-src | ‘self‘ cdn-cookieyes.com |
| style-src | ‘self‘ ‘unsafe-inline‘ |
| connect-src | ‘self‘ *.cookieyes.com cdn-cookieyes.com |
| img-src | ‘self‘ cdn-cookieyes.com |
| font-src | ‘self‘ |
| object-src | ‘none‘ |

> **Note:**

> The security protocol requirements may be different for your organisation.
>

In a meta tag, you can implement CSP using the directives and domain mentioned above, as shown in the following illustration:

```js
<meta
  http-equiv="Content-Security-Policy"
  content="default-src 'none'; script-src 'self' cdn-cookieyes.com; style-src 'self' 'unsafe-inline'; connect-src 'self' *.cookieyes.com cdn-cookieyes.com; img-src 'self' cdn-cookieyes.com; object-src 'none'; font-src 'self';"
/>
```

To assess the effectiveness and correctness of your CSP implementation, you can analyze and evaluate it through Google CSP Evaluator, which allows you to input your CSP header and get a report on its effectiveness. It provides recommendations and suggestions to improve your policy based on best practices.


---

## Structured Data

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Article",
      "headline": "Content Security Policy",
      "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.cookieyes.com/documentation/content-security-policy/"
      },
      "url": "https://www.cookieyes.com/documentation/content-security-policy/",
      "publisher": {
        "@type": "Organization",
        "name": "CookieYes",
        "url": "https://www.cookieyes.com",
        "logo": {
          "@type": "ImageObject",
          "url": "https://www.cookieyes.com/cookieyes-logo.png",
          "width": 2048,
          "height": 2048
        }
      },
      "description": "Explore the robust protection of websites against common vulnerabilities through the implementation of Content Security Policy",
      "datePublished": "2023-06-27T05:56:47+00:00",
      "dateModified": "2025-06-02T00:00:00+00:00",
      "author": {
        "@type": "Person",
        "name": "CookieYes Doc Team"
      },
      "image": [
        "https://assets.cookieyes.com/cookieyes.png"
      ]
    },
    {
      "@type": "BreadcrumbList",
      "@id": "https://www.cookieyes.com/documentation/content-security-policy/#breadcrumb",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Home",
          "item": "https://www.cookieyes.com/"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Documentation",
          "item": "https://www.cookieyes.com/documentation/"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "Features Documentation",
          "item": "https://www.cookieyes.com/category/documentation/features/"
        },
        {
          "@type": "ListItem",
          "position": 4,
          "name": "Consent Management",
          "item": "https://www.cookieyes.com/category/documentation/features/consent-management/"
        },
        {
          "@type": "ListItem",
          "position": 5,
          "name": "Content Security Policy",
          "item": "https://www.cookieyes.com/documentation/content-security-policy/"
        }
      ]
    },
    {
      "@type": "WebSite",
      "@id": "https://www.cookieyes.com/#website",
      "url": "https://www.cookieyes.com/",
      "name": "CookieYes",
      "description": "CookieYes is a Google-certified consent management platform that helps businesses comply with GDPR, CCPA, and other global privacy laws.",
      "inLanguage": "en-US",
      "publisher": {
        "@id": "https://www.cookieyes.com/#organization"
      },
      "potentialAction": {
        "@type": "SearchAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": "https://www.cookieyes.com/?s={search_term_string}"
        },
        "query-input": {
          "@type": "PropertyValueSpecification",
          "valueRequired": true,
          "valueName": "search_term_string"
        }
      }
    },
    {
      "@type": "Organization",
      "@id": "https://www.cookieyes.com/#organization",
      "name": "CookieYes",
      "url": "https://www.cookieyes.com/",
      "logo": {
        "@type": "ImageObject",
        "@id": "https://www.cookieyes.com/#/schema/logo/image/",
        "inLanguage": "en-US",
        "url": "https://www.cookieyes.com/cookieyes-logo.png",
        "contentUrl": "https://www.cookieyes.com/cookieyes-logo.png",
        "width": 2048,
        "height": 2048,
        "caption": "CookieYes"
      },
      "image": {
        "@id": "https://www.cookieyes.com/#/schema/logo/image/"
      }
    }
  ]
}
```
