diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cca131c..0ce82238 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ The release run heads these entries with the version and opens a fresh the wasm module is linked with `-sDYNAMIC_EXECUTION=0`, so embind builds its invokers without `new Function`. `script-src 'self' 'wasm-unsafe-eval'` is now enough. +- `wasm/README.md` says what Content-Security-Policy the rendered output needs, + and what each directive is for. The failures are quiet: a pdf whose `data:` + fonts are blocked renders as tofu rather than falling back. ## v6.9.0 - 2026-08-18 diff --git a/wasm/README.md b/wasm/README.md index f5871123..64cdecf2 100644 --- a/wasm/README.md +++ b/wasm/README.md @@ -47,7 +47,9 @@ try { so it needs nothing fetched alongside it. A `blob:` iframe keeps the same origin, so the page can still reach `iframe.contentWindow.odr` to drive `search()`, `searchNext()` and `generateDiff()`, exactly as the Android and iOS -apps do from their WebViews. +apps do from their WebViews. The frame inherits the embedding page's +Content-Security-Policy, so a page that ships one has to allow what the +document carries — see [Content-Security-Policy](#content-security-policy). Multi-page formats render one view at a time: @@ -86,6 +88,69 @@ where `Symbol.dispose` is supported. - Rendering is synchronous and a large PDF takes seconds, so run the module in a Web Worker. Pass `doc.handle` across `postMessage`, never the `Document`. +## Content-Security-Policy + +The rendered html is self-contained, but a frame inherits the embedding page's +policy — so the *embedder's* CSP decides what the document may load, and the +failures are quiet. Measured across an odt, ods, docx and pdf: + +| Directive | What in the output needs it | Seen in | +|---|---|---| +| `font-src data:` | embedded subset fonts | pdf (7 of 8 `@font-face`) | +| `img-src data:` | embedded images | odt, docx, standalone images | +| `style-src 'unsafe-inline'` | the document's own `