// The shipped Content Security Policy, pinned in both directions. // // This is the anti-regression check for #182. libsodium decides its // backend by trying to compile WebAssembly and catching the failure, so a // CSP that refuses WASM demotes the vault to the wasm2js translation — // roughly 20x slower per Argon2id derivation — and says so only in a // console message nobody reads. Dropping 'wasm-unsafe-eval' from either // manifest therefore has to fail a check, not a log line. // // It is equally a check against loosening. 'wasm-unsafe-eval' is granted // deliberately and narrowly (see the backend note in src/shared/vault.js); // 'unsafe-eval', 'unsafe-inline' and any remote script source are not, and // an exact match on the token set is what keeps the next edit from // smuggling one in alongside. // // It is also the anti-regression check for #307. The policy used to declare // script-src and object-src and nothing else, which left every directive // that does not fall back to them — and, absent default-src, every one that // does — wide open: a hostile ERC-20 symbol that reached innerHTML could // load a full-viewport cross-origin iframe over the wallet's own UI. The // escaping in src/shared/html.js is the primary fix; default-src is what // stops the next escape that slips from reaching the network. // // Every directive below is pinned exactly, because each of the four // loosenings is load-bearing and none of them may grow: // // style-src 'unsafe-inline' src/popup/index.html and the view helpers // use style="..." attributes throughout, which // CSP blocks without it. Chrome enforces this // on attributes, not just