// 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. The attribute pass // reads tags the way the browser's tokenizer does, and the page CSP is // `script-src 'none'` (the bridge scripts are injected by the WebView, // which CSP doesn't govern), so an inline handler that slipped through // would still not run. // // Tag/attribute lists mirror `lib/email-sanitization.ts` from the webmail. // `
${processed}