Added a function to sanitize the application name for the macOS installer prompt, improving consistency and security in the installation process.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-06-21 16:23:15 +01:00
parent b6c72bb902
commit bc5eea25bd

View File

@ -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 launchMacInstaller = (app, installerPath, webContents) => {
const installScript = buildMacInstallScript(app, installerPath) const installScript = buildMacInstallScript(app, installerPath)
const promptName = app.getName() || 'Farm Control' const promptName = getSudoPromptName(app)
console.log('[app-update] launching macOS installer:', { console.log('[app-update] launching macOS installer:', {
installerPath, installerPath,