Skip to content

Commit

Permalink
Escape commands passed to run and execute
Browse files Browse the repository at this point in the history
Each element in commands should be treated as a single argument so
we should escape it as an argument to prevent anything from
breakint out to execute anything else.
  • Loading branch information
stnguyen90 committed Mar 12, 2024
1 parent e417d32 commit d9b1277
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Orchestration/Adapter/DockerCLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ public function run(string $image,
$output = '';

foreach ($command as $key => $value) {
if (str_contains($value, ' ')) {
$command[$key] = "'".$value."'";
}
$command[$key] = \escapeshellarg($command[$key]);
}

$labelString = '';
Expand Down

0 comments on commit d9b1277

Please sign in to comment.