-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Description
Severity: P0 — Security
In apps/app/src/components/generative-ui/widget-renderer.tsx:523, the iframe sandbox attribute is:
sandbox="allow-scripts allow-same-origin"The combination of allow-scripts + allow-same-origin allows the iframe to access window.parent and all parent DOM/cookies. While the CSP mitigates remote script loading, agent-generated HTML with inline scripts has full same-origin access to the host page.
Failure mode
XSS via agent-generated content — malicious or hallucinated HTML could read/modify parent page state, steal cookies, or call CopilotKit APIs.
Suggested fix
Remove allow-same-origin from the sandbox. The iframe only needs allow-scripts. The postMessage bridge already works cross-origin. If allow-same-origin is truly required (e.g., for CDN fetches), tighten CSP connect-src and document the tradeoff.
Open question
Is allow-same-origin intentional? What breaks if it's removed?
From self-review finding F01