Skip to content

Commit

Permalink
Merge pull request #467 from ONLYOFFICE/hotfix/saveas-fileurl-vulnera…
Browse files Browse the repository at this point in the history
…bility

Hotfix/saveas fileurl vulnerability
  • Loading branch information
LinneyS authored Mar 4, 2024
2 parents b5a9e83 + 53bbc2d commit 5a7ecf6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,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 {
Expand Down
3 changes: 2 additions & 1 deletion l10n/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);");
3 changes: 2 additions & 1 deletion l10n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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);"
}

0 comments on commit 5a7ecf6

Please sign in to comment.