Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-04-20 10:20:52 +0300
committerJoas Schilling <coding@schilljs.com>2020-04-20 10:20:52 +0300
commitd43f67ec2ecbe24ff0aa6f53e498c4965047bf98 (patch)
tree4bde14705f6bbeb0031c07c706ea9d6540577e34 /lib/Service/CommandService.php
parent296596ca32ec320ecee108311aa9c1d814991127 (diff)
Prevent adding hurtful commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service/CommandService.php')
-rw-r--r--lib/Service/CommandService.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Service/CommandService.php b/lib/Service/CommandService.php
index 2f40b3f9c..b7d147cd8 100644
--- a/lib/Service/CommandService.php
+++ b/lib/Service/CommandService.php
@@ -142,6 +142,13 @@ class CommandService {
throw new \InvalidArgumentException('script', 3);
}
} else {
+ if (preg_match('/[`\'"]{(?:ARGUMENTS|ROOM|USER)}[`\'"]/i', $script)) {
+ throw new \InvalidArgumentException('script-parameters', 6);
+ }
+ if (strpos($script, '{ARGUMENTS_DOUBLEQUOTE_ESCAPED}') !== false) {
+ throw new \InvalidArgumentException('script-parameters', 6);
+ }
+
try {
$this->shellExecutor->execShell($script, '--help');
} catch (\InvalidArgumentException $e) {