Repository navigation
fix: check the sending frame for internal guest, window and reply IPCs - #53684
Merged
Merged
Conversation
* guest-view IPCs (attach/detach/call/property get/set) are honoured only from the frame that created the <webview>, not from any frame in the embedder WebContents * window.close() via the internal IPC is honoured only from the top-level document, and the renderer override is installed for the main frame only * replies to webContents.executeJavaScript()/insertCSS() and friends are accepted only from the main frame they were sent to * webContents.sendToFrame() only addresses frames that belong to that WebContents * the <webview> `ipc-message` event carries `frameOrigin` / `frameUrl` of the frame in the guest that sent it * process.getProcessMemoryInfo() reports the calling frame's own process * docs: validateSender example checks senderFrame.origin
VerteDinde
approved these changes
Sep 7, 2026
codebytere
approved these changes
Sep 7, 2026
|
Release Notes Persisted
|
Contributor
|
I was unable to backport this PR to "42-x-y" cleanly; |
Contributor
|
I was unable to backport this PR to "43-x-y" cleanly; |
This was referenced Sep 7, 2026
Contributor
|
I have automatically backported this PR to "44-x-y", please check out #53723 |
Contributor
|
I have automatically backported this PR to "45-x-y", please check out #53724 |
Contributor
|
@MarshallOfSound has manually backported this PR to "43-x-y", please check out #53726 |
Contributor
|
@MarshallOfSound has manually backported this PR to "42-x-y", please check out #53727 |
MarshallOfSound
added a commit
that referenced
this pull request
Sep 8, 2026
…s (42-x-y) (#53727) fix: check the sending frame for internal guest, window and reply IPCs (#53684) * fix: check the sending frame for internal guest, window and reply IPCs * guest-view IPCs (attach/detach/call/property get/set) are honoured only from the frame that created the <webview>, not from any frame in the embedder WebContents * window.close() via the internal IPC is honoured only from the top-level document, and the renderer override is installed for the main frame only * replies to webContents.executeJavaScript()/insertCSS() and friends are accepted only from the main frame they were sent to * webContents.sendToFrame() only addresses frames that belong to that WebContents * the <webview> `ipc-message` event carries `frameOrigin` / `frameUrl` of the frame in the guest that sent it * process.getProcessMemoryInfo() reports the calling frame's own process * docs: validateSender example checks senderFrame.origin * docs: add API history PR reference * refactor: drop frameOrigin/frameUrl from the webview ipc-message event (cherry picked from commit 8cc20cf)
MarshallOfSound
added a commit
that referenced
this pull request
Sep 8, 2026
…s (43-x-y) (#53726) fix: check the sending frame for internal guest, window and reply IPCs (#53684) * fix: check the sending frame for internal guest, window and reply IPCs * guest-view IPCs (attach/detach/call/property get/set) are honoured only from the frame that created the <webview>, not from any frame in the embedder WebContents * window.close() via the internal IPC is honoured only from the top-level document, and the renderer override is installed for the main frame only * replies to webContents.executeJavaScript()/insertCSS() and friends are accepted only from the main frame they were sent to * webContents.sendToFrame() only addresses frames that belong to that WebContents * the <webview> `ipc-message` event carries `frameOrigin` / `frameUrl` of the frame in the guest that sent it * process.getProcessMemoryInfo() reports the calling frame's own process * docs: validateSender example checks senderFrame.origin * docs: add API history PR reference * refactor: drop frameOrigin/frameUrl from the webview ipc-message event (cherry picked from commit 8cc20cf)
4 tasks done
jkleinsc
pushed a commit
that referenced
this pull request
Sep 18, 2026
) Removing a <webview> from the DOM tears down its internal iframe first, which destroys the guest and drops it from guestInstances. The element's disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that id. Since #53684 the handler validates the id with getGuestForFrame() before detaching, so the already-gone guest made the sync IPC throw back into disconnectedCallback. The uncaught error also skipped the element's reset, so a removed <webview> that was re-inserted never got a new guest. Treat a detach for an unknown guest as a no-op again (as detachGuest() always did) and keep the sender-frame check for live guests. Fixes #53989.
MarshallOfSound
added a commit
that referenced
this pull request
Sep 18, 2026
) Removing a <webview> from the DOM tears down its internal iframe first, which destroys the guest and drops it from guestInstances. The element's disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that id. Since #53684 the handler validates the id with getGuestForFrame() before detaching, so the already-gone guest made the sync IPC throw back into disconnectedCallback. The uncaught error also skipped the element's reset, so a removed <webview> that was re-inserted never got a new guest. Treat a detach for an unknown guest as a no-op again (as detachGuest() always did) and keep the sender-frame check for live guests. Fixes #53989. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 18, 2026
) Removing a <webview> from the DOM tears down its internal iframe first, which destroys the guest and drops it from guestInstances. The element's disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that id. Since #53684 the handler validates the id with getGuestForFrame() before detaching, so the already-gone guest made the sync IPC throw back into disconnectedCallback. The uncaught error also skipped the element's reset, so a removed <webview> that was re-inserted never got a new guest. Treat a detach for an unknown guest as a no-op again (as detachGuest() always did) and keep the sender-frame check for live guests. Fixes #53989. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 18, 2026
) Removing a <webview> from the DOM tears down its internal iframe first, which destroys the guest and drops it from guestInstances. The element's disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that id. Since #53684 the handler validates the id with getGuestForFrame() before detaching, so the already-gone guest made the sync IPC throw back into disconnectedCallback. The uncaught error also skipped the element's reset, so a removed <webview> that was re-inserted never got a new guest. Treat a detach for an unknown guest as a no-op again (as detachGuest() always did) and keep the sender-frame check for live guests. Fixes #53989. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 18, 2026
) Removing a <webview> from the DOM tears down its internal iframe first, which destroys the guest and drops it from guestInstances. The element's disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that id. Since #53684 the handler validates the id with getGuestForFrame() before detaching, so the already-gone guest made the sync IPC throw back into disconnectedCallback. The uncaught error also skipped the element's reset, so a removed <webview> that was re-inserted never got a new guest. Treat a detach for an unknown guest as a no-op again (as detachGuest() always did) and keep the sender-frame check for live guests. Fixes #53989. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<webview>.window.close()IPC is honoured only from the top-level document; replies towebContents.executeJavaScript()/insertCSS()are accepted only from the frame they were sent to;webContents.sendToFrame()only addresses frames of that WebContents;process.getProcessMemoryInfo()is scoped to the caller's process.security.mdsender-validation example checkssenderFrame.origin;webview-tag.mdpoints at the main-processipc-messageevent for identifying the sending frame.Notes: Internal
<webview>,window.close()andexecuteJavaScriptreply IPCs are validated against the sending frame.