mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-08-29 18:31:33 +00:00
fix: harden application trust boundaries (#1317)
This commit is contained in:
+12
-4
@@ -21,7 +21,7 @@ const net = require("net");
|
||||
const tls = require("tls");
|
||||
const zlib = require("zlib");
|
||||
const crypto = require("crypto");
|
||||
const { URL } = require("url");
|
||||
const { URL, pathToFileURL } = require("url");
|
||||
const { fork, spawn } = require("child_process");
|
||||
const pty = require("node-pty");
|
||||
const WebSocket = require("ws");
|
||||
@@ -1193,11 +1193,12 @@ function createWindow() {
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
webSecurity: false,
|
||||
sandbox: true,
|
||||
webSecurity: true,
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
partition: termixSessionPartition,
|
||||
allowRunningInsecureContent: true,
|
||||
webviewTag: true,
|
||||
allowRunningInsecureContent: false,
|
||||
webviewTag: false,
|
||||
offscreen: false,
|
||||
},
|
||||
show: true,
|
||||
@@ -1377,6 +1378,13 @@ function createWindow() {
|
||||
}
|
||||
return { action: "deny" };
|
||||
});
|
||||
|
||||
mainWindow.webContents.on("will-navigate", (event, url) => {
|
||||
const allowedUrl = isDev
|
||||
? url.startsWith("http://localhost:5173/")
|
||||
: url === pathToFileURL(path.join(appRoot, "dist", "index.html")).href;
|
||||
if (!allowedUrl) event.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
ipcMain.handle("get-app-version", () => {
|
||||
|
||||
Reference in New Issue
Block a user