Security & Safety

rich-html-editor is designed with security as a first-class concern. This page explains the editor’s security model, guarantees, and responsibilities.

Security is not a feature toggle — it is a core design constraint.

Iframe Isolation

The editor operates entirely inside an <iframe>.

This isolation significantly reduces the risk of unintended side effects.

Same-Origin Requirement

The iframe must be same-origin with the host page.

Same-origin access is required to:

For browser usage, iframe.srcdoc is strongly recommended.

Editable Region Control

The editor does not allow unrestricted editing.

Only certain candidate content elements (paragraphs, headings, spans, etc.) become editable; users make an element editable by clicking or focusing it. See Core Concepts for details.

<p>User-editable text</p>

This prevents users from:

Sanitization & Clean HTML

During editing, the editor may add temporary attributes or metadata.

When exporting HTML using:

editor.getHTML();

The editor ensures:

Exported HTML is suitable for storage, approval workflows, and deployment.

XSS Considerations

rich-html-editor minimizes XSS risk by:

If you accept user-provided HTML templates, you should still sanitize input before loading it into the editor.

What the Editor Does NOT Protect Against

Security is a shared responsibility.

Always apply appropriate server-side validation and sanitization when storing or serving HTML.

Enterprise Usage

rich-html-editor is suitable for enterprise environments where:

Next steps