Skip to content

Commit be2ddef

Browse files
oleksandr-ncbackportbot[bot]
authored andcommitted
fix(proxy): commit on first matching route by path and verb
fix(proxy): commit on first matching route by path and verb Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com> [skip ci]
1 parent e08ea65 commit be2ddef

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

lib/Controller/ExAppProxyController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ private function passesExAppProxyRoutesChecks(ExApp $exApp, string $exAppRoute):
316316
str_contains(strtolower($route['verb']), strtolower($this->request->getMethod())) &&
317317
$this->passesExAppProxyRouteAccessLevelCheck($route['access_level'])
318318
) {
319-
return $route;
319+
// First match by path+verb wins. Apply its access level without falling through to broader routes.
320+
return $this->passesExAppProxyRouteAccessLevelCheck($route['access_level']) ? $route : [];
320321
}
321322
}
322323
return [];

lib/Db/ExAppMapper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function findAll(?int $limit = null, ?int $offset = null): array {
4848
->leftJoin('a', 'ex_apps_daemons', 'd', $qb->expr()->eq('a.daemon_config_name', 'd.name'))
4949
->leftJoin('a', 'ex_apps_routes', 'r', $qb->expr()->eq('a.appid', 'r.appid'))
5050
->orderBy('a.appid', 'ASC')
51+
->addOrderBy('r.id', 'ASC')
5152
->setMaxResults($limit)
5253
->setFirstResult($offset);
5354
return $this->buildExAppWithRoutes($qb->executeQuery()->fetchAll());
@@ -80,6 +81,7 @@ public function findByAppId(string $appId): Entity {
8081
->leftJoin('a', 'ex_apps_daemons', 'd', $qb->expr()->eq('a.daemon_config_name', 'd.name'))
8182
->leftJoin('a', 'ex_apps_routes', 'r', $qb->expr()->eq('a.appid', 'r.appid'))
8283
->orderBy('a.appid', 'ASC')
84+
->addOrderBy('r.id', 'ASC')
8385
->where(
8486
$qb->expr()->eq('a.appid', $qb->createNamedParameter($appId))
8587
);

0 commit comments

Comments
 (0)