Skip to content

email_manager - render email body in sandboxed iframe#1521

Open
davmlaw wants to merge 1 commit intomasterfrom
email-manager-security
Open

email_manager - render email body in sandboxed iframe#1521
davmlaw wants to merge 1 commit intomasterfrom
email-manager-security

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Summary

Render email body HTML inside a sandboxed <iframe srcdoc="..."> in both email_pure.html and email_detail.html, rather than injecting it directly into the page DOM via | safe.

This prevents any script content in stored email bodies from executing in the viewer's browser.

Relates to SACGF/variantgrid_private#3828.

Test plan

  • Open a logged email via the email_manager detail view — body renders correctly inside the iframe
  • Open /email_manager/pure/<id> — body renders correctly in the standalone window
  • Confirm that email styling (inline CSS) is preserved inside the iframe

Prevents stored XSS by rendering email HTML content inside a sandboxed
iframe (srcdoc) rather than injecting it directly into the page DOM.
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