Only allow to window.open http and https protocols.

This commit is contained in:
Franco Montenegro 2022-02-16 19:28:21 -03:00 committed by jessopb
parent 8fb67d5980
commit aa40a44ce3

View file

@ -191,8 +191,11 @@ export default appState => {
});
window.webContents.setWindowOpenHandler((details) => {
// Open the link in a browser tab.
shell.openExternal(details.url);
// Only open http and https links to prevent
// security issues.
if (['https:', 'http:'].includes(new URL(details.url).protocol)) {
shell.openExternal(details.url);
}
return { action: 'deny' };
});