Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add senderIsMainFrame to messages sent via ipcRenderer.sendTo() #38868

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Jun 21, 2023

Description of Change

When nodeIntegrationInSubFrames is enabled in the originating webContents, a child frame with a different origin is able to send an IPC via ipcRenderer.sendTo() and the receiver has currently no way of telling whether the IPC came from the main frame or not.

The question is also whether ipcRenderer.sendTo shouldn't be deprecated as it can be replaced with MessageChannel + ipcRenderer.postMessage(), where the validation can be done in the main process before passing the MessagePort to the other renderer.

cc @electron/wg-security

Checklist

Release Notes

Notes: Added senderIsMainFrame to messages sent via ipcRenderer.sendTo()

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 21, 2023
@miniak miniak changed the title feat: add isMainFrame to events sent via ipcRenderer.sendTo() feat: add isMainFrame to IPCs sent via ipcRenderer.sendTo() Jun 21, 2023
@miniak miniak changed the title feat: add isMainFrame to IPCs sent via ipcRenderer.sendTo() feat: add isMainFrame to messages sent via ipcRenderer.sendTo() Jun 21, 2023
@miniak miniak self-assigned this Jun 21, 2023
@miniak miniak added semver/minor backwards-compatible functionality target/24-x-y PR should also be added to the "24-x-y" branch. target/25-x-y PR should also be added to the "25-x-y" branch. target/26-x-y PR should also be added to the "26-x-y" branch. labels Jun 21, 2023
@miniak miniak force-pushed the miniak/ipc-renderer-send-to-is-main-frame branch from 6a8554f to 475c2ae Compare June 21, 2023 11:46
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 28, 2023
@codebytere
Copy link
Member

codebytere commented Jul 17, 2023

@miniak given we've now moved towards deprecating ipcRenderer.sendTo(), is this still something you think is worth pursuing?

@miniak
Copy link
Contributor Author

miniak commented Jul 17, 2023

@codebytere yes it's a simple change that covers existing releases that can be backported

Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

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

API LGTM

@miniak miniak changed the title feat: add isMainFrame to messages sent via ipcRenderer.sendTo() feat: add senderIsMainFrame to messages sent via ipcRenderer.sendTo() Jul 18, 2023
Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

API LGTM

@codebytere codebytere merged commit 3df6d33 into main Jul 24, 2023
18 of 20 checks passed
@codebytere codebytere deleted the miniak/ipc-renderer-send-to-is-main-frame branch July 24, 2023 12:27
@release-clerk
Copy link

release-clerk bot commented Jul 24, 2023

Release Notes Persisted

Added senderIsMainFrame to messages sent via ipcRenderer.sendTo()

trop bot added a commit that referenced this pull request Jul 24, 2023
…o()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>
trop bot added a commit that referenced this pull request Jul 24, 2023
…o()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>
trop bot added a commit that referenced this pull request Jul 24, 2023
…o()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>
@trop
Copy link
Contributor

trop bot commented Jul 24, 2023

I have automatically backported this PR to "26-x-y", please check out #39206

@trop trop bot added in-flight/26-x-y and removed target/26-x-y PR should also be added to the "26-x-y" branch. labels Jul 24, 2023
@trop
Copy link
Contributor

trop bot commented Jul 24, 2023

I have automatically backported this PR to "24-x-y", please check out #39207

@trop
Copy link
Contributor

trop bot commented Jul 24, 2023

I have automatically backported this PR to "25-x-y", please check out #39208

@trop trop bot added in-flight/24-x-y in-flight/25-x-y and removed target/24-x-y PR should also be added to the "24-x-y" branch. target/25-x-y PR should also be added to the "25-x-y" branch. labels Jul 24, 2023
codebytere pushed a commit that referenced this pull request Jul 26, 2023
…o()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>
@trop trop bot added merged/24-x-y PR was merged to the "24-x-y" branch and removed in-flight/24-x-y labels Jul 27, 2023
codebytere pushed a commit that referenced this pull request Jul 27, 2023
…o()` (#39207)

* feat: add `senderIsMainFrame` to messages sent via `ipcRenderer.sendTo()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: Milan Burda <milan.burda@gmail.com>

* once -> emittedOnce

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
codebytere pushed a commit that referenced this pull request Jul 27, 2023
…o()` (#39208)

feat: add `senderIsMainFrame` to messages sent via `ipcRenderer.sendTo()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
@trop trop bot added merged/25-x-y PR was merged to the "25-x-y" branch. merged/26-x-y PR was merged to the "26-x-y" branch. and removed in-flight/25-x-y in-flight/26-x-y labels Jul 27, 2023
codebytere pushed a commit that referenced this pull request Jul 27, 2023
…o()` (#39206)

feat: add `senderIsMainFrame` to messages sent via `ipcRenderer.sendTo()` (#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
…o()` (electron#38868)

* feat: add isMainFrame to events emitted via ipcRenderer.sendTo()

* chore: rename isMainFrame to senderIsMainFrame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ merged/24-x-y PR was merged to the "24-x-y" branch merged/25-x-y PR was merged to the "25-x-y" branch. merged/26-x-y PR was merged to the "26-x-y" branch. semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants