harden(messages): SSRF guard on mailbox host, strict sandbox + sanitizer, per-account TLS

Pre-upstream review hardening:
- /accounts + /accounts/test now reject private/internal IMAP/SMTP hosts via
  isPrivateIP(), matching /config + /incoming-config (SSRF).
- QueueDetail body iframe uses sandbox="" (script-less, no same-origin) like the
  inbound pane, instead of allow-same-origin.
- /send sanitizer drops the <style> tag + data: scheme to match the stricter
  inbound sanitizeBody allowlist.
- Per-account SMTP transport sets tls.rejectUnauthorized explicitly.
This commit is contained in:
Luca
2026-07-07 16:04:11 +02:00
parent 2c5c1d561b
commit c8cb4c88ca
3 changed files with 21 additions and 4 deletions
@@ -480,8 +480,9 @@ const QueueDetail: React.FC<{ d: import('../../../services/email.service').Email
{d.renderedHtml ? (
<div className="mt-4 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden bg-white" style={{ height: '52vh' }}>
{/* rendered_html is our own template output — sandboxed, scripts blocked */}
<iframe title="Email body" sandbox="allow-same-origin" srcDoc={d.renderedHtml} className="w-full h-full border-0" />
{/* Our own template output, but rendered with a strict script-less,
no-same-origin sandbox anyway — matches the inbound-mail pane. */}
<iframe title="Email body" sandbox="" srcDoc={d.renderedHtml} className="w-full h-full border-0" />
</div>
) : (
<div className="mt-4 text-sm text-neutral-500 dark:text-neutral-400 italic">