Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/saveas fileurl vulnerability #467

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
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);"
}
Loading