---
title: Security & CSP
description: The Content Security Policy the viewer runs under, with no 'unsafe-inline', and what it does with a PDF you can't trust.
---
{/* Generated from docs/content — edit there, then `pnpm docs:sync`. */}
# Security & CSP
The viewer runs under a strict Content Security Policy: no `'unsafe-inline'`, no `'unsafe-eval'`,
and Trusted Types on. This is the policy to start from:
```http
Content-Security-Policy:
default-src 'self';
script-src 'self' 'wasm-unsafe-eval';
style-src 'self';
worker-src 'self';
img-src 'self' blob: data:;
connect-src 'self';
require-trusted-types-for 'script';
trusted-types embedpdf;
```
| Directive | Why the viewer needs it |
| :-- | :-- |
| `script-src 'wasm-unsafe-eval'` | The engine is WebAssembly, and the browser asks for this to compile any WebAssembly. It allows nothing else: no `eval`, no inline scripts. With CloudPDF it's needed only for Stamps and Signatures, which open their libraries in the browser. |
| `worker-src 'self'` | The engine runs in a Web Worker, loaded from a file next to the viewer's |
| `img-src blob: data:` | Pages are drawn into images the browser makes, and tool cursors are small inline images |
| `connect-src 'self'` | The engine's WebAssembly, your documents, and any fonts or stamps you configure. Add each origin you load from. |
| `trusted-types embedpdf` | The viewer's one Trusted Types policy, which only allows URLs of its own files and the ones you configure |
```http
Content-Security-Policy:
default-src 'self';
script-src 'self' 'wasm-unsafe-eval';
style-src 'self';
worker-src 'self';
img-src 'self' blob: data:;
connect-src 'self' https://engine.cloudpdf.com;
require-trusted-types-for 'script';
trusted-types embedpdf;
```
| Directive | Why the viewer needs it |
| :-- | :-- |
| `script-src 'wasm-unsafe-eval'` | Stamps and Signatures open their libraries in the browser, with the PDF engine, which is WebAssembly. The browser asks for this to compile any WebAssembly. It allows nothing else: no `eval`, no inline scripts. |
| `worker-src 'self'` | That engine runs in a Web Worker, loaded from a file next to the viewer's |
| `img-src blob: data:` | The pages arrive as images, which the viewer shows from `blob:` URLs, and tool cursors are small inline images |
| `connect-src https://engine.cloudpdf.com` | CloudPDF SaaS, where the pages, the text and every change come from. With your own CloudPDF, its origin instead (`engine: { baseUrl }`). `'self'` covers the WebAssembly; add the origins of any stamps you configure. |
| `trusted-types embedpdf` | The viewer's one Trusted Types policy, which only allows URLs of its own files and the ones you configure |
`style-src 'self'` is enough, without `'unsafe-inline'` or a nonce: the viewer never adds a
`