Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into feat/application-run-command

Stuart Rowlands08585f7e9acd
diff --cc app/Livewire/Project/Application/Command.php
index 86d40ab7b3,7d6bdb0f5f..5ee7e522af
--- a/app/Livewire/Project/Application/Command.php
+++ b/app/Livewire/Project/Application/Command.php
@@@ -92,16 -92,13 +92,16 @@@ class Command extends Componen
{
$this->validate();
try {
+ // Wrap command to prevent escaped execution in the host.
+ $cmd = 'sh -c "' . str_replace('"', '\"', $this->command) . '"';
+
if (!empty($this->workDir)) {
- $exec = "docker exec -w {$this->workDir} {$this->container} {$this->command}";
+ $exec = "docker exec -w {$this->workDir} {$this->container} {$cmd}";
} else {
- $exec = "docker exec {$this->container} {$this->command}";
+ $exec = "docker exec {$this->container} {$cmd}";
}
$activity = remote_process([$exec], $this->server, ignore_errors: true);
- $this->emit('newMonitorActivity', $activity->id);
+ $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --cc app/Livewire/Project/Shared/ExecuteContainerCommand.php
index 455926809b,06e48979b1..00798eb514
--- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php
+++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php
@@@ -92,16 -106,13 +106,16 @@@ class ExecuteContainerCommand extends C
{
$this->validate();
try {
+ // Wrap command to prevent escaped execution in the host.
+ $cmd = 'sh -c "' . str_replace('"', '\"', $this->command) . '"';
+
if (!empty($this->workDir)) {
- $exec = "docker exec -w {$this->workDir} {$this->container} {$this->command}";
+ $exec = "docker exec -w {$this->workDir} {$this->container} {$cmd}";
} else {
- $exec = "docker exec {$this->container} {$this->command}";
+ $exec = "docker exec {$this->container} {$cmd}";
}
$activity = remote_process([$exec], $this->server, ignore_errors: true);
- $this->emit('newMonitorActivity', $activity->id);
+ $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) {
return handleError($e, $this);
}