-
Notifications
You must be signed in to change notification settings - Fork 16k
feat: warn when remote is used without enableRemoteModule: true #21546
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
Conversation
Looks solid to me, but I wonder if we should add a link. That can happen in a later PR though, I'd first have to write said document. |
@felixrieseberg where should we link to? |
@@ -321,7 +321,7 @@ const unwrapArgs = function (sender: electron.WebContents, frameId: number, cont | |||
|
|||
const isRemoteModuleEnabledImpl = function (contents: electron.WebContents) { | |||
const webPreferences = (contents as any).getLastWebPreferences() || {} | |||
return !!webPreferences.enableRemoteModule | |||
return webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason why the default was false
is that devtools webContents don’t have webPreferences and the remote module should be disabled there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, do you have suggestions for how we can detect devtools webcontents but also know whether remote module was explicitly enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this in a follow-up PR if I don’t forget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this PR, improvements can be continued in other PRs.
Release Notes Persisted
|
Description of Change
This is the first step of #21408, issuing a warning when using the 'remote' module without
enableRemoteModule: true
.Checklist
npm test
passesRelease Notes
Notes: Began issuing a deprecation warning when the 'remote' module is used when enableRemoteModule: true isn't explicitly specified. See #21408 for more details.