Skip to content

[_] feature/Render the body of an email - #587

Open
CandelR wants to merge 3 commits into
feature/fix-mail-securityfrom
feature/sanitize-render-full-html-mail
Open

CandelR wants to merge 3 commits into
feature/fix-mail-securityfrom
feature/sanitize-render-full-html-mail

Conversation

@CandelR

@CandelR CandelR commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The body of an external email was displayed as plain text: no colours, no buttons, no images.

Summary

  • services/mail/emailBody/sanitizeMailHtml.ts: sanitize-html with the mail policy, an allowlist of tags, allowedSchemes, and no protocol relative URLs.
  • services/mail/emailBody/emailBodyContent.ts: resolveEmailBody decides which body is displayed, from a source that can only be one of three things, so a message that could not be decrypted can no longer fall through to a readable copy of itself. plainTextToHtml escapes plain text bodies and keeps their line breaks.
  • services/mail/emailBody/emailDocument.ts: wraps the body in a document declaring default-src 'none', with form-action and base-uri closed as well since they do not inherit from it. Images hosted elsewhere are blocked until the reader asks for them, because loading them tells the sender the message was opened, when, from which IP and on what device.
  • screens/mail/EmailDetailScreen/EmailBody.tsx: the web view, with a notice and a button to load the blocked images.
    • screens/mail/EmailDetailScreen/hooks/useEmailBodyHeight.ts: React Native does not know how tall a message is, so the document reports it. The hook caps the value, ignores what is not a height, falls back to a height that shows something when nothing is ever reported, and starts over when another message is displayed, so a message is never left invisible.

@CandelR CandelR self-assigned this Sep 9, 2026
@CandelR
CandelR added this pull request to stack #583 September 9, 2026 14:53
@CandelR CandelR added the enhancement New feature or request label Sep 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@CandelR
CandelR requested a review from xabg2 September 15, 2026 13:04
@CandelR
CandelR marked this pull request as ready for review September 15, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant