diff --git a/documentation/how-to.md b/documentation/how-to.md index fa04f4649..2a12ac966 100644 --- a/documentation/how-to.md +++ b/documentation/how-to.md @@ -321,6 +321,22 @@ as before, and an embed that passes a token keeps getting Mapbox under `auto`. --- +## Embed under a strict Content-Security-Policy + +No bundle needs `'unsafe-eval'` (translations compile without `eval`; `bun run check:no-eval`), and +every third-party script is pinned with an integrity hash (`library/constants/cdn.js`, +`bun run check:cdn-pins`). A page embedding the maps needs, in addition to its own sources: + +| Directive | Add | Why | +|---|---|---| +| `script-src` | `https://cdn.jsdelivr.net` (and `https://api.mapbox.com` for Mapbox) | the map engine and the search geocoder | +| `style-src` | `'unsafe-inline'`, the same CDN hosts | each plugin styles its own shadow root with a `