gosec

This commit is contained in:
naiba
2021-09-04 12:42:51 +08:00
parent 67faa7a63d
commit e40026f6cc
8 changed files with 13 additions and 14 deletions

View File

@@ -290,9 +290,9 @@ func handleCommandTask(task *pb.Task, result *pb.TaskResult) {
}
timeout := time.NewTimer(time.Hour * 2)
if utils.IsWindows() {
cmd = exec.Command("cmd", "/c", task.GetData())
cmd = exec.Command("cmd", "/c", task.GetData()) // #nosec
} else {
cmd = exec.Command("sh", "-c", task.GetData())
cmd = exec.Command("sh", "-c", task.GetData()) // #nosec
}
cmd.Env = os.Environ()
pg.AddProcess(cmd)

View File

@@ -32,7 +32,7 @@ func Start() (*Pty, error) {
if shellPath == "" {
return nil, errors.New("没有可用终端")
}
cmd := exec.Command(shellPath)
cmd := exec.Command(shellPath) // #nosec
cmd.Env = append(os.Environ(), "TERM=xterm")
tty, err := opty.Start(cmd)
return &Pty{tty: tty, cmd: cmd}, err