Add explicit security related flags to browser windows

This commit is contained in:
Max Goodhart
2020-06-20 22:58:56 -07:00
parent 2a626fa396
commit 23e195ba03
2 changed files with 12 additions and 2 deletions

View File

@@ -95,7 +95,12 @@ export default class StreamWindow extends EventEmitter {
createView() {
const { win, overlayView, viewActions } = this
const view = new BrowserView({
webPreferences: { partition: 'persist:session', sandbox: true },
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
partition: 'persist:session',
sandbox: true,
},
})
view.setBackgroundColor('#000')

View File

@@ -81,7 +81,12 @@ async function main() {
} else if (msg.type === 'browse') {
if (!browseWindow || browseWindow.isDestroyed()) {
browseWindow = new BrowserWindow({
webPreferences: { partition: 'persist:session', sandbox: true },
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
partition: 'persist:session',
sandbox: true,
},
})
}
browseWindow.loadURL(msg.url)