#12

Load email images automatically

MergedstylesshOwnermerged intofrom

Summary

  • load sanitized HTTPS images automatically when an email body first renders
  • remove the manual remote-image gate while retaining iframe sandboxing
  • keep the email document policy limited to HTTPS and embedded image sources
  • cover image sanitization and document policy with regression tests

Validation

  • pnpm test (23 passing)
  • pnpm build
  • pnpm exec eslint components/mail/message-body.tsx lib/render/sanitize.ts lib/render/sanitize.test.mjs
  • git diff --check origin/main...HEAD

Known repository lint issues

The full pnpm lint command still reports existing errors in babel.config.js, postcss.config.js, and components/shell/login-screen.tsx; none are touched by this PR.

Activity

4
mikey3mo ago

Review

Blocking: this removes the only privacy mitigation against email tracking pixels.

The PR deletes the "Load remote images" gate (allowRemote state, the button, blockedRemote gating in sanitizeEmailHtml, and the img-src restriction in wrapEmailDocument). The result is that every HTTPS <img> in an email body — including invisible 1x1 tracking pixels senders use to log opens, timestamps, and reader IP/client — now loads automatically the instant a thread renders, with no per-message or per-session control.

This is standard threat-modeling territory for a mail client: Gmail, Outlook, Apple Mail, and Thunderbird all block remote images by default and require explicit user action to load them, specifically to prevent this class of tracking. Removing the gate is a real behavioral regression for every Redakt user, not a UX nicety being trimmed.

The iframe sandbox attribute (unchanged by this diff, components/mail/message-body.tsx:120) doesn't compensate — it never restricted image network fetches, only script/form/other capabilities, so it provides no mitigation for the tracking-pixel exposure the removed gate existed to prevent.

Specific spots where the gate's removal takes effect:

  • lib/render/sanitize.ts:29 — img-src is now unconditionally https: data: with no per-message opt-in.
  • components/mail/message-body.tsx:64 — sanitizeEmailHtml/wrapEmailDocument are now always called in "allow remote" mode; there's no remaining state or UI to gate it.

Recommendation: keep an explicit opt-in (even a coarser one, e.g. per-thread, or a "always load from this sender" preference) before fetching remote image sources. If the intent is genuinely to always auto-load images, that's a product/privacy trade-off worth confirming explicitly with stakeholders rather than landing as a default-behavior change in a PR titled "Load email images automatically."

Non-blocking:

  • New tests (lib/render/sanitize.test.mjs) only cover the surviving (always-allow) behavior; there's no coverage documenting that the previous gate's removal is an intentional trade-off versus an oversight.

Verified: diff applies cleanly against main (07ea9a5), single commit, 3 files changed (components/mail/message-body.tsx, lib/render/sanitize.ts, new lib/render/sanitize.test.mjs). Confirmed by source inspection that no other opt-in/preference mechanism (user settings, per-sender allowlist, image proxy) exists elsewhere in the codebase that would otherwise mitigate this.

(Note: submitted as a plain comment rather than a formal review — this run's token has pulls:comment but not pulls:write, so inline review comments and request-changes status could not be posted.)

stylessh merged commit 6a9c0cd into main3mo ago

Branch stylessh/auto-load-email-images has been merged.

Checking branch