Skip to content

Commit cd5cce0

Browse files
committed
fix(recording): Stop broken recording backend
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent f40ece0 commit cd5cce0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/Controller/PageController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ protected function pageHandler(string $token = '', string $callUser = '', string
280280
#[NoCSRFRequired]
281281
#[PublicPage]
282282
#[BruteForceProtection(action: 'talkRoomToken')]
283+
#[BruteForceProtection(action: 'talkRecordingStatus')]
283284
public function recording(string $token): Response {
284285
try {
285286
$room = $this->manager->getRoomByToken($token);
@@ -291,6 +292,13 @@ public function recording(string $token): Response {
291292
return $response;
292293
}
293294

295+
if ($room->getCallRecording() === Room::RECORDING_NONE) {
296+
$response = new NotFoundResponse();
297+
$this->logger->debug('Recording "' . ($this->userId ?? 'ANONYMOUS') . '" throttled for accessing "' . $token . '"', ['app' => 'spreed-bfp']);
298+
$response->throttle(['token' => $token, 'action' => 'talkRecordingStatus']);
299+
return $response;
300+
}
301+
294302
if (class_exists(LoadViewer::class)) {
295303
$this->eventDispatcher->dispatchTyped(new LoadViewer());
296304
}

lib/Controller/RecordingController.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ protected function getInputStream(): string {
161161
#[OpenAPI(scope: 'backend-recording')]
162162
#[PublicPage]
163163
#[BruteForceProtection(action: 'talkRecordingSecret')]
164+
#[BruteForceProtection(action: 'talkRecordingStatus')]
164165
public function backend(): DataResponse {
165166
$json = $this->getInputStream();
166167
if (!$this->validateBackendRequest($json)) {
@@ -218,6 +219,22 @@ private function backendStarted(array $started): DataResponse {
218219
], Http::STATUS_NOT_FOUND);
219220
}
220221

222+
if ($room->getCallRecording() === Room::RECORDING_NONE) {
223+
$this->logger->error('Recording backend tried to start recording in room {token}, but it was not requested by a moderator.', [
224+
'token' => $token,
225+
'app' => 'spreed-recording',
226+
]);
227+
$response = new DataResponse([
228+
'type' => 'error',
229+
'error' => [
230+
'code' => 'no_such_room',
231+
'message' => 'Room not found.',
232+
],
233+
], Http::STATUS_NOT_FOUND);
234+
$response->throttle(['action' => 'talkRecordingStatus']);
235+
return $response;
236+
}
237+
221238
try {
222239
$participant = $this->participantService->getParticipantByActor($room, $actor['type'], $actor['id']);
223240
} catch (ParticipantNotFoundException $e) {

0 commit comments

Comments
 (0)