// Safe HTML shaping for email bodies rendered inside a sandboxed WebView. // // Layered defenses (in order of importance): // 1. The WebView runs the content with `originWhitelist={['about:blank']}` // and a strict Content-Security-Policy meta (default-src 'none'), so // external resources are blocked by the engine itself unless the policy // allows them. This is the primary boundary. // 2. `onShouldStartLoadWithRequest` refuses any navigation except the // initial about:blank doc - links are opened in the OS browser / composer. // 3. This module pre-strips known-dangerous tags and on* attributes so the // rendered DOM is also clean. Regex stripping is imperfect; it is here // as belt-and-suspenders, not the primary defense. `script-src // 'unsafe-inline'` has to stay on for the injected measurement bridge, // so a parser-differential bypass of the regex stripper would execute in // the WebView. The blast radius is small: the page has no origin, no // storage, no cookies, and the bridge only accepts height/swipe/zoom // strings - but it is the residual risk of not using a real HTML parser. // // Tag/attribute lists mirror `lib/email-sanitization.ts` from the webmail. // `
${processed}