66. pepsi-stage-defang

Neutralise the remote references in HTML mail.

66.1. Role

pepsi-stage-defang removes everything that a message’s HTML would load from the network by itself when it is displayed: tracking pixels, remote images, style sheets, fonts and frames. Opening a message then tells its sender nothing (Remote content and personalised links reveal opens, device and location), and a decrypted HTML part cannot send its own plaintext to a server either (EFAIL direct exfiltration: plaintext spliced into attacker content). It is off by default and turned on per address by the address’s owner. Reference: pepsi-stage-defang(1).

66.2. Features

  • Per address: DEFANG = on|off (default off) is read after per-address settings, so a user can turn it on for their own mail with a settings mail (pepsi-stage-edit-settings), and the operator can with pepsi-settings set ADDRESS defang DEFANG on; recipients whose settings differ get their own copies. Where it is certainly off, the stage fuses through using only the message’s metadata and does not load the body.

  • What goes: src, srcset, poster, background and the other loading attributes; href everywhere but on <a> and <area>; frames’ and plug-ins’ sources; ping; url(), @import and URL strings in style attributes, <style>, text/css parts and SVG properties; <base href>, <meta http-equiv=refresh>, <script>. cid: parts and inline data:image/... images stay, and so do links and forms: following them is the reader’s own act.

  • Read as a browser reads it: the stage follows the HTML tokenizer’s own rules for tags, quotes, comments and raw text, and it writes output that reads the same where the browser’s reading depends on the tree (raw text inside <svg>, <math>, <select>). It also rewrites the inside of Outlook’s conditional comments. It decodes each part according to its transfer encoding and charset, and encodes it again.

  • Signatures stay intact: nothing inside a multipart/signed, an application/pkcs7-mime or an inline OpenPGP block is touched.

  • Marked: a changed message carries X-Pepsi-Warning: remote-content-defanged, which the client extensions show as a note (Mail client extensions).

66.3. Configuration

[stage-<name>]: PROGRAM = pepsi-stage-defang, NEXT_STAGE (required) and DEFANG. The wizard wires it with DEFANG = off after every stage that verifies or reads the content and after ~/.forward, immediately before pepsi-stage-reencrypt (or local delivery), and offers it to the settings editor. If you list it in EDITABLE_STAGES, users get only this switch, and the switch can only remove what a message shows (Per-address settings are a trust boundary).

66.4. State

  • Inputs: none.

  • Outputs: none; the X-Pepsi-Warning field and the log say what was done.

66.5. See also

Using Pepsi: a guide for users, pepsi-stage-edit-settings, pepsi-stage-reencrypt, pepsi-stage-defang(1).