From cc870ca3024790ff20e08bc360335a0b16ca0eb7 Mon Sep 17 00:00:00 2001 From: "Mauro E. Bender" Date: Tue, 14 May 2024 14:29:27 +0200 Subject: [PATCH] Fix scheduled tasks being executed using host environment variables --- app/Jobs/ScheduledTaskJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/ScheduledTaskJob.php b/app/Jobs/ScheduledTaskJob.php index 4a38a005b..a389dceec 100644 --- a/app/Jobs/ScheduledTaskJob.php +++ b/app/Jobs/ScheduledTaskJob.php @@ -89,7 +89,7 @@ class ScheduledTaskJob implements ShouldQueue foreach ($this->containers as $containerName) { if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container . '-' . $this->resource->uuid)) { - $cmd = 'sh -c "' . str_replace('"', '\"', $this->task->command) . '"'; + $cmd = "sh -c '" . str_replace("'", "'\''", $this->task->command) . "'"; $exec = "docker exec {$containerName} {$cmd}"; $this->task_output = instant_remote_process([$exec], $this->server, true); $this->task_log->update([