mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
- G204 in proc_spawner_nix.go and proc_spawner_win.go: exePath is the server's own validated binary path, not arbitrary user input - G302 in updater.go: 0o755 is required for the extracted Linux binary to be executable
23 lines
507 B
Go
23 lines
507 B
Go
//go:build windows
|
|
|
|
package updater
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
// SpawnDetached starts a new process that is not attached to the current one.
|
|
func SpawnDetached(exePath string, args []string) error {
|
|
cmd := exec.Command(exePath, args...) //nolint:gosec // G204: exePath is the server's own binary path, validated by the caller
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
|
CreationFlags: 0x00000008, // DETACHED_PROCESS
|
|
}
|
|
|
|
return cmd.Start()
|
|
}
|