Skip to content

fix(data-browser): validate messages arriving in the webview VSCODE-804 - #1366

Merged
ivandevp merged 2 commits into
mainfrom
vscode-804-validate-webview-messages
Sep 25, 2026
Merged

ivandevp merged 2 commits into
mainfrom
vscode-804-validate-webview-messages

Conversation

@ivandevp

Copy link
Copy Markdown
Contributor

Description

Hardens inbound message handling in the data browser webview:

  • messages are only processed when they come from the panel's own webview origin
  • payloads are validated against the command they declare before being dispatched, and unknown commands are ignored

On the approach: the check originally suggested on the ticket, event.source !== window.parent, is not viable here. The webview app runs in a sandboxed frame where window.parent is the frame itself, so that comparison discards legitimate messages. This was verified against a running extension host, where the origin comparison holds for everything VS Code delivers.

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Targets the VSCODE-805 branch, since it builds on that work. Retarget to main once #15 merges.

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@ivandevp
ivandevp requested a review from a team as a code owner September 25, 2026 11:59
@ivandevp
ivandevp requested a review from mabaasit September 25, 2026 11:59
@ivandevp
ivandevp merged commit d85ed9f into main Sep 25, 2026
18 checks passed
@ivandevp
ivandevp deleted the vscode-804-validate-webview-messages branch September 25, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants