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
+1
View File
@@ -798,6 +798,7 @@ async function sendRawEmail({ to, cc, subject, html, text, attachments, accountK
port: parseInt(acct.smtp_port, 10) || 587,
secure: acct.smtp_secure === true || acct.smtp_secure === 1,
auth: acct.smtp_user && acct.smtp_pass ? { user: acct.smtp_user, pass: acct.smtp_pass } : undefined,
tls: { rejectUnauthorized: true },
});
fromEmail = acct.from_email || acct.smtp_user;
fromName = acct.from_name || '';