--- title: "Trusted Markup And Security" description: "The escaping model of @ecopages/jsx and the trusted paths that opt out of it." group: JSX order: 6 --- # Trusted Markup And Security `@ecopages/jsx` escapes ordinary text and attribute values by default. It is **not** an HTML sanitizer and does not filter URLs, CSS, or user-generated markup. **Consumer responsibility:** sanitize or allowlist anything from users, APIs, CMS content, or wire formats **before** it reaches a trusted path. The package protects against accidental unescaped interpolation; it does not own application threat models. ## What The Runtime Escapes | Path | Behavior | | :-- | :-- | | Text children | Escaped on SSR; mounted as text nodes on the client | | Text children in `textarea`, `title`, `style`, `script` | Written as the element's character data; comment anchors are not used | | Ordinary attributes | Escaped for HTML attribute context (including `"`) | | Plain `{ nodeType, outerHTML }` objects | Treated as text (escaped / text node), not raw HTML | ## Trusted Paths (Author And Framework Data Only) These surfaces emit or parse raw HTML by design. Pass only content you already trust. | Surface | Contract | | :-- | :-- | | Compiled JSX / template `strings[]` | Static author HTML; emitted raw | | Transported `{ strings, values }` | Only via `toTemplateResultLike(...)` from `@ecopages/jsx/jsx-runtime`; `strings` are trusted author HTML, dynamic `values` are still escaped | | `unsafeHtml(...)` / `createMarkupNodeLike(...)` | Branded markup; `outerHTML` emitted and parsed raw | | Live `Node` instances | `outerHTML` emitted raw (slot projection / host passthrough) | | Custom-element `renderHostToString` / server render hooks | Host HTML is trusted; return branded markup via `createMarkupNodeLike(...)` | | `