# Content Security Policy

All Kendo UI for Angular components comply with the strict [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) standards. This article describes in more detail how the strict CSP mode can affect the Kendo UI for Angular suite and what policy configuration your application may need in some scenarios.

## Strict Content Security Policy(CSP) and What it Affects

If a strict CSP mode is enabled, some browser features are disabled, such as:

* Inline JavaScript in the form of `<script>` tags or legacy DOM attributes such as `onclick`, are blocked. All script code must live in separate files, served from a whitelisted domain.
* Inline CSS in the form of `<style> `tags and `style` attributes.
* Fonts and images from [Base64](https://developer.mozilla.org/en-US/docs/Glossary/Base64) `data:` portions in stylesheets.
* Dynamic code evaluation via `eval()`.

## Policy Configuration

These limitations can affect the Kendo UI for Angular components, because they need the following:

* To enable the loading of [font icons](https://www.telerik.com/kendo-angular-ui/components/styling/icons), allow `'data:'` sources for `font-src`. Since `v14.0.0`, introduced in the R3 2023 (October 2023) release, the Kendo UI for Angular components use [SVG icons](https://www.telerik.com/kendo-angular-ui/components/styling/icons#using-svg-icons) by default.

* If you use our CDN, you must also allow it as a source for stylesheets.

  ```html
  <meta http-equiv="Content-Security-Policy" content="
        style-src 'self' 'unsafe-inline' https://kendo.cdn.telerik.com;
        style-src-elem 'self' 'unsafe-inline' https://kendo.cdn.telerik.com;
        font-src 'self' data:;
        img-src 'self' data:"
  />
  ```

* Allow `'unsafe-inline'` for `style-src` to enable Angular components to load encapsulated styles when using the Editor in [encapsulated mode](https://www.telerik.com/kendo-angular-ui/components/editor/styling#encapsulated-mode).

  > Since version `17.0.0`, the Kendo UI for Angular Spreadsheet supports strict CSP compliance. The only exception is when using the [defineFunction(name, func)](https://www.telerik.com/kendo-angular-ui/components/spreadsheet/action-bar#custom-formulas) method of the component. In this case, allow `'unsafe-eval'` for `script-src`.

* Allow controlled `innerHTML` usage when you use the `require-trusted-types-for 'script'; trusted-types angular;` directive by implementing a [default Trusted Types policy](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API#the_default_policy). The components use `innerHTML` to set placeholder content during virtualization and to render dynamic content for icons and indicators. All content is controlled by the components and uses only safe, predefined HTML entities that pose no XSS risk.

A sample application is available on the [Kendo UI for Angular public GitHub repo](https://github.com/telerik/kendo-angular/tree/master/examples-standalone/grid-csp-enabled).

> To enable CSP, your application needs to use Ahead of Time Compilation (AOT). The Just-in-Time (JIT) compiler is not suitable as it generates dynamic scripts at runtime.
