diff --git a/README.md b/README.md index 24782a5..5d41a96 100644 --- a/README.md +++ b/README.md @@ -1464,10 +1464,44 @@ policy, but as of now there are none. ### Content Security Policy -Both manifests declare the same policy for extension pages — -`script-src 'self' 'wasm-unsafe-eval'; object-src 'self'` — as an object under +Both manifests declare the same policy for extension pages, as an object under `content_security_policy.extension_pages` in `manifest/chrome.json` (MV3) and as -a bare string in `manifest/firefox.json` (MV2). +a bare string in `manifest/firefox.json` (MV2): + +``` +default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; +style-src 'self' 'unsafe-inline'; img-src 'self' data:; +connect-src 'self' https: http:; frame-src 'none'; form-action 'none'; +base-uri 'none' +``` + +`default-src 'self'` is the floor. Without it the policy governed script and +plugins only, and everything else — frames above all — was unrestricted, which +is what let an unescaped token symbol paint a cross-origin iframe over the +wallet's own UI. Escaping is the primary fix for that (see +`src/shared/html.js`); this is the second line, so an escape that does slip +cannot reach the network. + +Four directives are looser than `'self'`, each for a reason that does not +generalise: + +- `style-src 'unsafe-inline'` — `src/popup/index.html` and the view helpers set + presentation through `style="..."` attributes, which CSP blocks without this. + Chrome enforces `style-src` on attributes, not only on `