Reference
GenUI Safety & Restrictions
Safety model (OWASP LLM05: every widget passes through this)
src/core/safety.js:
safeText(s, max=2000): coerces to string, strips ASCII control chars (the C0 rangeU+0000-U+001FplusU+007FDEL), length-clamps.safeUrl(url, {allow}): returns the URL only if its scheme is allow-listed (defaulthttps|http|mailto|tel). It blocksjavascript:,data:,vbscript:, and unknown schemes. A scheme-relative path (/foo,foo/bar) is allowed, but an authority-relative URL (//host,\\host) is rejected (open-redirect / embed-hijack vector). An absolute URL with embedded userinfo (https://user:pass@host/...) is also rejected (phishing / link-spoofing vector).external-videoadditionally requires an absolute http(s) URL.renderSafeLink(info, opts): builds a real<a>viacreateElement,textContent, and a scheme-checkedhref(neverinnerHTML). Setstarget=_blankandrel=noopener noreferrer. Returnsnulloutside a browser or for an unsafe URL.sanitizeJson(v): drops__proto__/constructor/prototype(used bysubmitStructuredDataFormandsetDynamicPrompt).clampInbound(s)clamps inbound text.- No renderer emits HTML. The host renders the
{kind, data}descriptor withtextContent/ DOM APIs. Asummary's markdown is the host's responsibility to sanitize.
Restrictions & gotchas (read before you build)
- Live socket and widgets: the live socket does not produce flashcards or summarization widgets. See Two delivery paths.
force_experienceis a hint. Never assume the requested experience arrived; the renderer parses whatever shows up.- Runtimes outside this set are NOT in
RUNTIMES. The renderer routes them to{kind:'unknown'}andonUnhandledrather than faking a known kind. sourcesneeds a knowledge base to cite from. Ground a new agent viaknowledge.addRecordandknowledge_ids(ungated; see Ground the Agent in Your Content).sourcesthen renders the real retrieved citations.entryIdplayback needs the Kaltura player.video-gallerypreservesentryId. WhenembedUrlis present (it requirespartnerId;uiConfIdis optional and only pins a specific player uiConf), the SDK renders an inline player. Without it, the host renders byentryId.
Related docs
| Doc | Covers |
|---|---|
| GenUI · Per-Runtime Widget Detail | Per-runtime model keys, constraints, and descriptor shapes |
| GenUI · Authoring and Consuming Widgets | Capability gating and ExperienceRenderer/mountWidget consumption |
| GenUI Reference | Back to the index |