Use Local DOMPurify Implementation Pending Core UI Sanitization API
- Deciders: Julian Bäume
- Date: 2025-10-23
Status
Superseded by ADR-0026 on 2026-09-09. Mail bodies are now sanitized with the App Suite mail sanitizer ($/io.ox/mail/sanitizer) through the host adapter of the library-ready mail content frame, and the local DOMPurify module ui/teams/utils/sanitize.ts was removed. Comments and drafts continue to rely on TipTap's schema-based protection. The shared component library will ship its own sanitizer, so the $/io.ox/core/security/sanitize migration path described below is no longer planned.
Context
Teams renders untrusted HTML from external email sources via v-html, creating a critical XSS vulnerability. App Suite typically uses a centralized DOMPurify instance, but no Core UI sanitization API currently exists.
Waiting for a Core UI API is not feasible given the critical security risk. However, we can design the local implementation to be extraction-ready.
Decision
Implement HTML sanitization locally in Teams using DOMPurify, with an API designed for future extraction to Core UI.
Module Location: ui/teams/utils/sanitize.js
Design Principles:
- Self-contained module that can be extracted as-is
- Three configuration presets:
mailContent,userComment,draft - Hooks for future global configuration override
- API surface designed to remain stable through Core UI migration
Migration Path:
Current: import { sanitize } from '@/teams/utils/sanitize' Future: import { sanitize } from '$/io.ox/core/security/sanitize'
Only import paths change; API remains identical.
Applied To:
mail-detail.vue- Email content (critical fix)- Comments rely on TipTap's built-in XSS protection (optional
sanitizeComment()available)
Consequences
Positive
- Immediate fix for critical XSS vulnerability
- API designed as reference implementation for Core UI
- Comprehensive test coverage (40 unit tests)
- Clear migration path with minimal code changes
Negative
- Temporary code duplication until Core UI provides API
- Each plugin manages DOMPurify dependency separately
- ~25KB bundle size per plugin (will be shared once centralized)
Future Work
When Core UI provides sanitization API:
- Extract module to
$/io.ox/core/security/sanitize - Update import paths (zero code changes needed)
- Centralize DOMPurify instance and configuration
- Deprecate local implementations

