Skip to content

fix: sanitize HTML with DOMPurify to prevent stored XSS#5

Merged
mpge merged 5 commits intomainfrom
security/fix-stored-xss
Feb 15, 2026
Merged

fix: sanitize HTML with DOMPurify to prevent stored XSS#5
mpge merged 5 commits intomainfrom
security/fix-stored-xss

Conversation

@mpge
Copy link
Member

@mpge mpge commented Feb 15, 2026

  • Add DOMPurify sanitization to ReplyThread.vue and PinnedNotes.vue
  • All v-html rendered content is now sanitized before rendering
  • Closes stored XSS vector from inbound email bodies and user-submitted HTML

- Add DOMPurify sanitization to ReplyThread.vue and PinnedNotes.vue
- All v-html rendered content is now sanitized before rendering
- Closes stored XSS vector from inbound email bodies and user-submitted HTML
@mpge mpge force-pushed the security/fix-stored-xss branch from 3ca4ffa to 607d19a Compare February 15, 2026 23:23
mpge added 2 commits February 15, 2026 18:30
DOMPurify caused import resolution failures in CI. Replace with a
built-in sanitizer that mirrors the server-side approach (strip
disallowed tags, event handlers, javascript: URIs, CSS expressions).
Revert test export count to 28 (i18n exports are not on this branch).
- Commit useI18n.js and locale files that were untracked (CI failure)
- Loop event handler removal until stable to prevent bypass via
  nested/overlapping patterns (CodeQL incomplete sanitization fix)
Replace regex-based sanitization with DOMParser tree-walking approach.
Parses HTML into a DOM tree, removes dangerous elements (script, iframe,
etc.), strips event handler attributes and javascript: URIs by inspecting
parsed attribute names/values. This avoids the incomplete multi-character
sanitization pattern that CodeQL flags with regex replacements.
@mpge mpge self-assigned this Feb 15, 2026
@mpge mpge merged commit 89c0828 into main Feb 15, 2026
5 checks passed
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