aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorSaúl Ibarra Corretgé <s@saghul.net>2023-05-09 13:14:34 +0200
committerSaúl Ibarra Corretgé <s@saghul.net>2023-05-09 15:18:42 +0200
commit2202530dfcc40f8ff793baf0c16e7615f03203fb (patch)
tree18cdf208474caeed3a327850544c1986e0720b3f /main.js
parentdf4bd258d2aac19945edb5c3ea1daee281d73bce (diff)
fix(main) filter redirect protocols
Diffstat (limited to 'main.js')
-rw-r--r--main.js18
1 files changed, 18 insertions, 0 deletions
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);