mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Merge pull request #16526 from nextcloud/backport/16523/stable29
[stable29] fix(matterbridge): Check parameters
This commit is contained in:
commit
39b0c73ca7
1 changed files with 18 additions and 1 deletions
|
|
@ -128,7 +128,7 @@ class MatterbridgeManager {
|
||||||
$newBridge = [
|
$newBridge = [
|
||||||
'enabled' => $enabled,
|
'enabled' => $enabled,
|
||||||
'pid' => $currentBridge['pid'] ?? 0,
|
'pid' => $currentBridge['pid'] ?? 0,
|
||||||
'parts' => $parts,
|
'parts' => $this->validateParts($parts),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->notify($room, $userId, $currentBridge, $newBridge);
|
$this->notify($room, $userId, $currentBridge, $newBridge);
|
||||||
|
|
@ -351,6 +351,7 @@ class MatterbridgeManager {
|
||||||
private function generateConfig(array $bridge): string {
|
private function generateConfig(array $bridge): string {
|
||||||
$content = '';
|
$content = '';
|
||||||
foreach ($bridge['parts'] as $k => $part) {
|
foreach ($bridge['parts'] as $k => $part) {
|
||||||
|
$k = (int)$k;
|
||||||
$type = $part['type'];
|
$type = $part['type'];
|
||||||
|
|
||||||
if ($type === 'nctalk') {
|
if ($type === 'nctalk') {
|
||||||
|
|
@ -507,6 +508,22 @@ class MatterbridgeManager {
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function validateParts(array $parts): array {
|
||||||
|
foreach ($parts as $k => $part) {
|
||||||
|
if (!is_numeric($k)) {
|
||||||
|
$this->logger->error('User tried to configure a malicious matterbridge setup');
|
||||||
|
throw new \InvalidArgumentException('Invalid matterbridge parameters');
|
||||||
|
}
|
||||||
|
foreach ($part as $key => $value) {
|
||||||
|
if (preg_match('/["\n]/', $key) || preg_match('/["\n]/', $value)) {
|
||||||
|
$this->logger->error('User tried to configure a malicious matterbridge setup');
|
||||||
|
throw new \InvalidArgumentException('Invalid matterbridge parameters');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $parts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the scheme from an URL and add port
|
* Remove the scheme from an URL and add port
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue