Skip to content

chat: fix SecurityError with cross-origin MCP App iframes and enable by default - #289453

Merged
Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/289386
Jan 21, 2026
Merged

chat: fix SecurityError with cross-origin MCP App iframes and enable by default#289453
Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/289386

Conversation

@connor4312

Copy link
Copy Markdown
Member
  • Change event.source.origin check to event.origin to avoid SecurityError
    when accessing cross-origin frames in patched postMessage handlers
  • Enable MCP Apps UI by default (mcpAppsEnabledConfig changed from false
    to true) since the feature is now stable and ready for general use

Fixes #289386

(Commit message generated by Copilot)

…by default

- Change event.source.origin check to event.origin to avoid SecurityError
  when accessing cross-origin frames in patched postMessage handlers
- Enable MCP Apps UI by default (mcpAppsEnabledConfig changed from false
  to true) since the feature is now stable and ready for general use

Fixes #289386

(Commit message generated by Copilot)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes cross-origin SecurityError in MCP App message handling and turns MCP Apps UI on by default.

Changes:

  • Update the patched message event listener wrapper to use event.origin instead of reading event.source.origin (avoids cross-origin access errors).
  • Change chat.mcp.apps.enabled default from false to true.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts Avoids SecurityError by switching origin checks to event.origin in the injected postMessage/event-listener shim.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Enables MCP Apps UI by default via configuration default change.

Comment thread src/vs/workbench/contrib/chat/browser/chat.contribution.ts
@connor4312
Connor Peet (connor4312) merged commit 75eb0bc into main Jan 21, 2026
27 of 28 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/289386 branch January 21, 2026 18:44
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Mar 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP App: Uncaught SecurityError thrown when communicating with (trusted) nested iframes

3 participants