From bc5eea25bd5fdc7e111acee82fce3259d6f0c0fb Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 21 Jun 2026 16:23:15 +0100 Subject: [PATCH] Added a function to sanitize the application name for the macOS installer prompt, improving consistency and security in the installation process. --- public/appupdate.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/public/appupdate.js b/public/appupdate.js index b2a5dbe..e5c386a 100644 --- a/public/appupdate.js +++ b/public/appupdate.js @@ -217,9 +217,21 @@ const buildWindowsInstallCommand = (app, installerPath) => ({ ] }) +const getSudoPromptName = (app) => { + const fallback = 'Farm Control' + const rawName = String(app.getName?.() || fallback) + const sanitized = rawName + .replace(/[^a-z0-9 ]/gi, ' ') + .replace(/\s+/g, ' ') + .trim() + .slice(0, 70) + + return sanitized || fallback +} + const launchMacInstaller = (app, installerPath, webContents) => { const installScript = buildMacInstallScript(app, installerPath) - const promptName = app.getName() || 'Farm Control' + const promptName = getSudoPromptName(app) console.log('[app-update] launching macOS installer:', { installerPath,