-
-
Save matt-/d331de3ca08fe4b850c7c23f3869309f to your computer and use it in GitHub Desktop.
CVE-2018-15685
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mainWindow.webContents.on('new-window', e => e.preventDefault()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const enforceInheritance = (topWebContents) => { | |
const handle = (webContents) => { | |
webContents.on('new-window', (event, url, frameName, disposition, options) => { | |
if (!options.webPreferences) { | |
options.webPreferences = {} | |
} | |
Object.assign(options.webPreferences, topWebContents.getLastWebPreferences()) | |
if (options.webContents) { | |
handle(options.webContents) | |
} | |
}) | |
} | |
handle(topWebContents) | |
} | |
enforceInheritance(mainWindow.webContents) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open('about:blank').open('data:text/html,<script>document.write(process.cwd())</script>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
win.webPreferences = { | |
allowRunningInsecureContent: false, | |
contextIsolation: true, | |
nodeIntegration: false, | |
nativeWindowOpen: true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment