mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-06 07:57:04 +08:00
fix: sanitize mail content in reply/forward to prevent XSS (#857)
* fix: sanitize mail content in reply/forward to prevent XSS - Add DOMPurify to sanitize HTML email content (whitelist-based) - Add escapeHtml for plain text content (escape &<>"') - Guard mail.originalSource with fallback to empty string - Add jsdom for vitest DOM environment (DOMPurify requires DOM) - Add XSS regression tests (script tags, event handlers, HTML escape) - Add contentType assertion for empty message fallback case Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add XSS sanitization E2E screenshots Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove temporary screenshots from tree Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: normalize escapeHtml input and add forward text escape test - escapeHtml: convert input via String(str ?? '') to handle non-string values - Add test for plain text forward with special chars (<, &, >) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
372f7b4149
commit
0c337a1942
@@ -21,6 +21,7 @@
|
||||
- fix: |Frontend| Fix email content text being unreadable in dark theme, improve dark mode styles for plain text mail and Shadow DOM rendering
|
||||
- docs: |Docs| Add Admin API documentation for delete mail, delete address, clear inbox, and clear sent items
|
||||
- fix: |Frontend| Fix reply to HTML email losing original HTML content, prefer HTML message over plain text
|
||||
- fix: |Security| Fix XSS vulnerability in reply/forward mail content, sanitize HTML with DOMPurify whitelist and escape plain text
|
||||
|
||||
### Improvements
|
||||
|
||||
|
||||
Reference in New Issue
Block a user