#12
Load email images automatically
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 buildpnpm exec eslint components/mail/message-body.tsx lib/render/sanitize.ts lib/render/sanitize.test.mjsgit 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.
Review
Blocking: this removes the only privacy mitigation against email tracking pixels.
The PR deletes the "Load remote images" gate (
allowRemotestate, the button,blockedRemotegating insanitizeEmailHtml, and theimg-srcrestriction inwrapEmailDocument). 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
sandboxattribute (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-srcis now unconditionallyhttps: data:with no per-message opt-in.components/mail/message-body.tsx:64—sanitizeEmailHtml/wrapEmailDocumentare 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:
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, newlib/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:commentbut notpulls:write, so inline review comments and request-changes status could not be posted.)