mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #22908] [MERGED] enh: allow iframe postMessage prompts without same-origin (with HITL confirmation) #26922
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22908
Author: @Classic298
Created: 3/20/2026
Status: ✅ Merged
Merged: 3/21/2026
Merged by: @tjbck
Base:
dev← Head:fix/iframe-postmessage-origin-check📝 Commits (2)
d2bf44aUpdate Chat.svelte8a2578cUpdate Chat.svelte📊 Changes
1 file changed (+29 additions, -7 deletions)
View changed files
📝
src/lib/components/chat/Chat.svelte(+29 -7)📄 Description
allow iframe postMessage prompts without same-origin (with HITL confirmation)
Problem
The onMessageHandler in Chat.svelte checks event.origin against window.origin and silently drops messages from sandboxed iframes that don't have same-origin access. This means Rich UI tools that use the input:prompt:submit postMessage protocol (e.g. interactive buttons that send prompts back to the chat) only work when "iframe Sandbox Allow Same Origin" is enabled.
Requiring same-origin for this feature is a security tradeoff: it also exposes parent.document, parent.fetch, and parent.localStorage to iframe JavaScript — which is far more access than sendPrompt needs.
Solution
When same-origin is enabled, prompt messages go through immediately (unchanged behavior).
When same-origin is disabled, cross-origin input:prompt:submit messages now trigger the existing EventConfirmDialog instead of being silently dropped. The user sees the message text and can confirm or cancel before it is submitted. This prevents abuse (spam) while still enabling the feature without requiring same-origin access.
Other cross-origin message types (input:prompt, action:submit) are also allowed through to the handler — input:prompt only fills the input box without submitting, and action:submit uses the existing prompt text.
Changes
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.