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

Prohibit Object methods being called through IPC #6780

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

GytisCepk
Copy link
Contributor

@GytisCepk GytisCepk commented May 31, 2024

Motivation

IPC expects only methods defined in a custom IPC interface to be called, but it does not account for all other methods defined in an IPC handler. For this reason, it is possible to execute methods that exist in the IPC handler but are not intended to be called from the frontend. This includes all methods inherited from the Object and any methods defined as private in TypeScript code.

This could be exploited by malicious party to weaken security (work item for more details).

Changes

Changes in this PR prevent methods inherited from Object class (e.g.: toString, __defineSetter__) from being called through IPC.

It would be great to also prohibit private methods in custom IPC handlers from being callable, but it's not possible, since, if they are defined private in TypeScript, this information is not available during runtime. Added a recommendation to the documentation to either remove private methods from IPC handlers or define them as JavaScript private properties.

@pmconne
Copy link
Member

pmconne commented May 31, 2024

Your PR description should specify why you want to do this.

@GytisCepk
Copy link
Contributor Author

Your PR description should specify why you want to do this.

Updated description.

Copy link
Member

@pmconne pmconne left a comment

Choose a reason for hiding this comment

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

I want to discuss with @wgoehrig first.

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.

None yet

3 participants