From 2202530dfcc40f8ff793baf0c16e7615f03203fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 9 May 2023 13:14:34 +0200 Subject: fix(main) filter redirect protocols --- main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'main.js') diff --git a/main.js b/main.js index b4c5c56..4d71d8a 100644 --- a/main.js +++ b/main.js @@ -250,6 +250,7 @@ function createJitsiMeetWindow() { if (!requestedBasename.startsWith(appBasePath)) { callback(false); + console.log(`Rejected file URL: ${details.url}`); return; } @@ -276,6 +277,23 @@ function createJitsiMeetWindow() { }); }); + // Block redirects. + const allowedRedirects = [ + 'http:', + 'https:', + 'ws:', + 'wss:' + ]; + + mainWindow.webContents.addListener('will-redirect', (ev, url) => { + const requestedUrl = new URL.URL(url); + + if (!allowedRedirects.includes(requestedUrl.protocol)) { + console.log(`Disallowing redirect to ${url}`); + ev.preventDefault(); + } + }); + initPopupsConfigurationMain(mainWindow); setupAlwaysOnTopMain(mainWindow, null, windowOpenHandler); setupPowerMonitorMain(mainWindow); -- cgit v1.2.3