Skip to content

fix(mail): don't send a Referer when loading remote email content - #43

Open
heraldb wants to merge 1 commit into
naust-mail:mainfrom
heraldb:fix/email-iframe-no-referrer
Open

heraldb wants to merge 1 commit into
naust-mail:mainfrom
heraldb:fix/email-iframe-no-referrer

Conversation

@heraldb

@heraldb heraldb commented Oct 30, 2026

Copy link
Copy Markdown

Problem

After you press Allow on remote content, images in LinkedIn mail stay empty boxes. Thunderbird shows them fine.

The email iframe sends the webmail origin as Referer on every remote image request. LinkedIn's image CDNs reject requests with a foreign referer:

$ curl -s -o /dev/null -w '%{http_code}\n' https://static.licdn.com/aero-v1/sc/h/2fp5x7ci191mxbdy1eynscn59
200
$ curl -s -o /dev/null -w '%{http_code}\n' -H 'Referer: https://mail.example.com/' https://static.licdn.com/aero-v1/sc/h/2fp5x7ci191mxbdy1eynscn59
400

media.licdn.com (logos, profile photos) behaves the same.

Change

In EmailRenderer.tsx, a no-referrer policy is set in two places:

  • referrerPolicy="no-referrer" on the <iframe>
  • <meta name="referrer" content="no-referrer"> in the srcdoc document

This also stops leaking the webmail host to senders, which fits the existing remote-content privacy handling.

Testing

  • With headless Chrome and Firefox against a local server that logs the Referer of an image inside a sandboxed srcdoc iframe: before the change the parent origin was sent, after it no referer was sent.
  • Deployed on a self-hosted instance: LinkedIn images now load in Chrome after Allow.

🤖 Generated with Claude Code

The email iframe sent the webmail origin as Referer on every remote
image request. Some CDNs reject foreign referers: LinkedIn's
media.licdn.com and static.licdn.com return 400, so all images in
LinkedIn mail showed as empty boxes after allowing remote content.

Set a no-referrer policy on the iframe element and inside the srcdoc
document. This also stops leaking the webmail host to senders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant