security: iframe sandbox allows same-origin access to parent page

Offen
#3 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
typescript
Bereich
frontend, security

Rechercherichtung

Start at apps/app/src/components/generative-ui/widget-renderer.tsx:523 and inspect how the iframe sandbox and postMessage bridge are configured. Test what breaks when allow-same-origin is removed, including any CDN or fetch behavior mentioned in the issue. Done means the sandbox uses only the permissions required by the renderer, the bridge still works, and the intentional security tradeoff is documented if the permission must remain.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

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

Vorherrschende Sprache
TypeScript
Sterne
1.6k
Forks
202
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus CopilotKit/OpenGenerativeUI

Alle Issues in CopilotKit/OpenGenerativeUI

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.