Skip to content

Commit dfdd5ba

Browse files
authored
Merge pull request #867 from nextcloud/fix/proxy-input-validation
fix(proxy): validate request path before forwarding to ExApp
2 parents 878eeb2 + 215346a commit dfdd5ba

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
@@ -236,6 +236,12 @@ private function prepareProxy(
236236
string $appId, string $other, array &$route, array &$bruteforceProtection, int &$delay,
237237
): ?ExApp {
238238
$delay = 0;
239+
if (preg_match('#(?:^|/|%2[fF])(?:\.|%2[eE]){2}(?:/|%2[fF]|$)#', $other) === 1) {
240+
$this->logger->debug(
241+
sprintf('Returning status 404 for "%s": path contains a parent-directory segment.', $other)
242+
);
243+
return null;
244+
}
239245
$exApp = $this->exAppService->getExApp($appId);
240246
if ($exApp === null) {
241247
$this->logger->debug(

0 commit comments

Comments
 (0)