mirror of
https://github.com/vector-im/element-desktop.git
synced 2024-09-10 06:15:17 +00:00
Merge pull request #91 from vector-im/travis/ipc-renderer
Enforce sandbox on all spawned BrowserWindow objects
This commit is contained in:
commit
d33ce95dd0
1 changed files with 12 additions and 1 deletions
|
@ -615,6 +615,17 @@ protocol.registerSchemesAsPrivileged([{
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
// Turn the sandbox on for *all* windows we might generate. Doing this means we don't
|
||||||
|
// have to specify a `sandbox: true` to each BrowserWindow.
|
||||||
|
//
|
||||||
|
// This also fixes an issue with window.open where if we only specified the sandbox
|
||||||
|
// on the main window we'd run into cryptic "ipc_renderer be broke" errors. Turns out
|
||||||
|
// it's trying to jump the sandbox and make some calls into electron, which it can't
|
||||||
|
// do when half of it is sandboxed. By turning on the sandbox for everything, the new
|
||||||
|
// window (no matter how temporary it may be) is also sandboxed, allowing for a clean
|
||||||
|
// transition into the user's browser.
|
||||||
|
app.enableSandbox();
|
||||||
|
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
try {
|
try {
|
||||||
await setupGlobals();
|
await setupGlobals();
|
||||||
|
@ -725,7 +736,7 @@ app.on('ready', async () => {
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: preloadScript,
|
preload: preloadScript,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
sandbox: true,
|
//sandbox: true, // We enable sandboxing from app.enableSandbox() above
|
||||||
enableRemoteModule: false,
|
enableRemoteModule: false,
|
||||||
// We don't use this: it's useful for the preload script to
|
// We don't use this: it's useful for the preload script to
|
||||||
// share a context with the main page so we can give select
|
// share a context with the main page so we can give select
|
||||||
|
|
Loading…
Reference in a new issue