Skip to content

Commit c457285

Browse files
authored
Merge pull request #3362 from nextcloud/backport/3361/stable5.2
[stable5.2] fix: only clone question from same form
2 parents f73626b + 50d53d3 commit c457285

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/Controller/ApiController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ public function newQuestion(int $formId, ?string $type = null, string $text = ''
533533

534534
try {
535535
$sourceQuestion = $this->questionMapper->findById($fromId);
536+
// Only allow cloning questions that belong to the same form
537+
if ($sourceQuestion->getFormId() !== $formId) {
538+
throw new OCSBadRequestException('Question doesn\'t belong to given form');
539+
}
536540
$sourceOptions = $this->optionMapper->findByQuestion($fromId);
537541
} catch (IMapperException $e) {
538542
$this->logger->debug('Could not find question');

0 commit comments

Comments
 (0)