Escape command in ExecuteContainerCommand.
This commit is contained in:
		@@ -92,10 +92,13 @@ class ExecuteContainerCommand extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->validate();
 | 
					        $this->validate();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
					            // Wrap command to prevent escaped execution in the host.
 | 
				
			||||||
 | 
					            $cmd = 'sh -c "' . str_replace('"', '\"', $this->command)  . '"';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!empty($this->workDir)) {
 | 
					            if (!empty($this->workDir)) {
 | 
				
			||||||
                $exec = "docker exec -w {$this->workDir} {$this->container} {$this->command}";
 | 
					                $exec = "docker exec -w {$this->workDir} {$this->container} {$cmd}";
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                $exec = "docker exec {$this->container} {$this->command}";
 | 
					                $exec = "docker exec {$this->container} {$cmd}";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $activity = remote_process([$exec], $this->server, ignore_errors: true);
 | 
					            $activity = remote_process([$exec], $this->server, ignore_errors: true);
 | 
				
			||||||
            $this->emit('newMonitorActivity', $activity->id);
 | 
					            $this->emit('newMonitorActivity', $activity->id);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user