mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 18:15:48 +00:00
fix(macos-bar): launch dashboard without shell (#1549)
Launches the dashboard without going through a shell, avoiding unescaped-command exposure.
This commit is contained in:
1 parent
8bd289bfae
commit
50f136a1f0
1 file changed
+8
-4
@@ -48,12 +48,16 @@ enum DashboardLauncher {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server isn't up. Start it via `ccs config`, fully detached (nohup) so it
|
// Server isn't up. Start it via `ccs config`; it opens the dashboard on its
|
||||||
// survives this app quitting; it opens the dashboard on its own.
|
// own. Avoid a shell here: candidate paths can include user-controlled
|
||||||
|
// components, and Process can pass the executable and arguments directly.
|
||||||
if let bin = ccsBinary() {
|
if let bin = ccsBinary() {
|
||||||
let proc = Process()
|
let proc = Process()
|
||||||
proc.executableURL = URL(fileURLWithPath: "/bin/sh")
|
proc.executableURL = URL(fileURLWithPath: bin)
|
||||||
proc.arguments = ["-c", "nohup \"\(bin)\" config >/dev/null 2>&1 &"]
|
proc.arguments = ["config"]
|
||||||
|
let null = FileHandle(forWritingAtPath: "/dev/null")
|
||||||
|
proc.standardOutput = null
|
||||||
|
proc.standardError = null
|
||||||
try? proc.run()
|
try? proc.run()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user