Skip to content

Commit

Permalink
Proxy: check all routes until we find allowing route (#366)
Browse files Browse the repository at this point in the history
Yes, it changes the algorithm, but otherwise it does not work in PGSQL
in production.

And so it is a little simpler, since the order of routes in `info.xml`
is not important

Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 authored Aug 22, 2024
1 parent 685ca63 commit 5e907e8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Controller/ExAppProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@ private function buildMultipartFormData(array $bodyParams, array $files): array

private function passesExAppProxyRoutesChecks(ExApp $exApp, string $exAppRoute): bool {
foreach ($exApp->getRoutes() as $route) {
$matchesUrlPattern = preg_match('/' . $route['url'] . '/i', $exAppRoute) === 1;
$matchesVerb = str_contains(strtolower($route['verb']), strtolower($this->request->getMethod()));
if ($matchesUrlPattern && $matchesVerb) {
return $this->passesExAppProxyRouteAccessLevelCheck($route['access_level']);
if (preg_match('/' . $route['url'] . '/i', $exAppRoute) === 1 &&
str_contains(strtolower($route['verb']), strtolower($this->request->getMethod())) &&
$this->passesExAppProxyRouteAccessLevelCheck($route['access_level'])
) {
return true;
}
}
return false;
Expand Down

0 comments on commit 5e907e8

Please sign in to comment.