From c12a5da25885c73436ef2eec9c06f372b2329b7e Mon Sep 17 00:00:00 2001 From: rivexe Date: Mon, 4 Mar 2024 10:18:40 +0300 Subject: [PATCH 1/2] fix: saveas file url vulnerability --- controller/editorcontroller.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index db269095..383b4cf9 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -761,6 +761,18 @@ public function save($name, $dir, $url) { return ["error" => $this->trans->t("You don't have enough permission to create")]; } + $documentServerUrl = $this->config->getDocumentServerUrl(); + + if (empty($documentServerUrl)) { + $this->logger->error("documentServerUrl is empty", ["app" => $this->appName]); + return ["error" => $this->trans->t("ONLYOFFICE app is not configured. Please contact admin")]; + } + + if (parse_url($url, PHP_URL_HOST) !== parse_url($documentServerUrl, PHP_URL_HOST)) { + $this->logger->error("Incorrect domain in file url", ["app" => $this->appName]); + return ["error" => $this->trans->t("The domain in the file url does not match the domain of the Document server")]; + } + $url = $this->config->replaceDocumentServerUrlToInternal($url); try { From 53bbc2d14e890b88e804d2df82f4a83bdc04f7cc Mon Sep 17 00:00:00 2001 From: rivexe Date: Mon, 4 Mar 2024 10:19:17 +0300 Subject: [PATCH 2/2] feat: translations added --- l10n/ru.js | 3 ++- l10n/ru.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/l10n/ru.js b/l10n/ru.js index 493ec51a..9ed026a7 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -126,6 +126,7 @@ OC.L10N.register( "Select file to combine" : "Выбрать файл для объединения", "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", - "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам" + "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" }, "nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"); diff --git a/l10n/ru.json b/l10n/ru.json index 7fca1dc2..dbbbe8d2 100644 --- a/l10n/ru.json +++ b/l10n/ru.json @@ -124,6 +124,7 @@ "Select file to combine" : "Выбрать файл для объединения", "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", - "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам" + "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" },"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);" } \ No newline at end of file