Browse Source

Ensure that no webviews can be created with nodeIntegration.

pull/3202/head
TheGoddessInari 7 years ago
parent
commit
771266f578
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 9
      electron/main.js

9
electron/main.js

@ -325,7 +325,6 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
if (shouldQuit) {
app.quit();
return;
}
// Code for downloading images as temporal files
@ -471,3 +470,11 @@ app.on('activate', function () {
app.on('before-quit', function () {
isQuitting = true;
});
// Prevent the ability to create webview with nodeIntegration.
app.on('web-contents-created', (event, contents) => {
contents.on('will-attach-webview', (event, webPreferences, params) => {
// Always prevent node integration
webPreferences.nodeIntegration = false;
});
});

Loading…
Cancel
Save