Skip to content

Commit c865d78

Browse files
authored
Merge pull request #871 from nextcloud/backport/867/stable30
[stable30] fix(proxy): validate request path before forwarding to ExApp
2 parents 9ee5708 + e123a53 commit c865d78

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/Controller/ExAppProxyController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ private function prepareProxy(
231231
string $appId, string $other, array &$route, array &$bruteforceProtection, int &$delay
232232
): ?ExApp {
233233
$delay = 0;
234+
if (preg_match('#(?:^|/|%2[fF])(?:\.|%2[eE]){2}(?:/|%2[fF]|$)#', $other) === 1) {
235+
$this->logger->debug(
236+
sprintf('Returning status 404 for "%s": path contains a parent-directory segment.', $other)
237+
);
238+
return null;
239+
}
234240
$exApp = $this->exAppService->getExApp($appId);
235241
if ($exApp === null) {
236242
$this->logger->debug(

0 commit comments

Comments
 (0)