From c02a8154301ae1452f8d5cbb3a40d6e6b23c1345 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 19:53:59 +0000 Subject: [PATCH] Add $cmd array validation to execCommandInContainer Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/45d5228c-7834-404e-ba54-90b5c8c207c8 Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com> --- php/src/Docker/DockerActionManager.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index c2148fe8..3b0f31ae 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -761,6 +761,15 @@ readonly class DockerActionManager { } public function execCommandInContainer(Container $container, array $cmd, ?\Closure $outputCallback = null): void { + if ($cmd === []) { + throw new \InvalidArgumentException('$cmd must not be empty.'); + } + foreach ($cmd as $arg) { + if (!is_string($arg) || $arg === '') { + throw new \InvalidArgumentException('Every element of $cmd must be a non-empty string.'); + } + } + if ($this->GetContainerStartingState($container) !== ContainerState::Running) { return; }