Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/integration-mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
guests-versions: ['v3.0.1']
call-summary-bot-versions: ['stable30']
notifications-versions: ['stable28']

services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
guests-versions: ['v3.0.1']
call-summary-bot-versions: ['stable30']
notifications-versions: ['stable28']

services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
guests-versions: ['v3.0.1']
call-summary-bot-versions: ['stable30']
notifications-versions: ['stable28']

services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.3']
server-versions: ['stable28']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
guests-versions: ['v3.0.1']
call-summary-bot-versions: ['stable30']
notifications-versions: ['stable28']

services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
guests-versions: ['v3.0.1']
call-summary-bot-versions: ['stable30']
notifications-versions: ['stable28']

steps:
Expand Down
19 changes: 18 additions & 1 deletion lib/MatterbridgeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function editBridgeOfRoom(Room $room, string $userId, bool $enabled, arra
$newBridge = [
'enabled' => $enabled,
'pid' => $currentBridge['pid'] ?? 0,
'parts' => $parts,
'parts' => $this->validateParts($parts),
];

$this->notify($room, $userId, $currentBridge, $newBridge);
Expand Down Expand Up @@ -351,6 +351,7 @@ private function generatePassword(): string {
private function generateConfig(array $bridge): string {
$content = '';
foreach ($bridge['parts'] as $k => $part) {
$k = (int)$k;
$type = $part['type'];

if ($type === 'nctalk') {
Expand Down Expand Up @@ -507,6 +508,22 @@ private function generateConfig(array $bridge): string {
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
*
Expand Down
Loading