Rendering untrusted HTML email, safely (2021)

11 points by juliethefoxcoon


goldstein

I feel like either blocking or proxying remote images is table stakes for modern email clients. tracking pixels are everywhere and sending notifications every time you open an email is really creepy. I think blocking could be achieved with adding img-src and friends to CSP?

ejri

I should probably do a write-up on this at some point, but always interesting to hear how others handle this issue.

We recently moved from allow-same-origin to an opaque origin with srcdoc due to limitations with Webkit and disallowing scripts. So now we're doing sanitization, then an opaque origin iframe, with our own small script to communicate above over a message channel for things like size, focus, and keybinds.

freddyb

What an odd way to deal with untrusted HTML... I think you want both, sanitization and a restricted rendering content (eg serving the content with a CSP sandbox flag)