From 0910f72522061486084bca3e4c5990edaf6c80dc Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Fri, 15 May 2026 10:47:04 +0000 Subject: [PATCH 1/2] fix(proxy): match route URL against request path including leading slash (HaRP alignment) Signed-off-by: Oleksander Piskun --- lib/Controller/ExAppProxyController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Controller/ExAppProxyController.php b/lib/Controller/ExAppProxyController.php index e30059f9..800fd5aa 100644 --- a/lib/Controller/ExAppProxyController.php +++ b/lib/Controller/ExAppProxyController.php @@ -317,6 +317,8 @@ private function buildMultipartFormData(array $bodyParams, array $files): array } private function passesExAppProxyRoutesChecks(ExApp $exApp, string $exAppRoute): array { + // Route URL is a regex matched against the request path including its leading slash, mirroring HaRP's target_path semantics. + $exAppRoute = '/' . $exAppRoute; foreach ($exApp->getRoutes() as $route) { $pattern = '~^(?:' . str_replace('~', '\\~', $route['url']) . ')~i'; if (preg_match($pattern, $exAppRoute) === 1 From 622083a3677e9fc7b0501ca94bd928f7628f33d5 Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Fri, 15 May 2026 11:52:41 +0000 Subject: [PATCH 2/2] fix(proxy): add transitional bare-path fallback for legacy route URLs Signed-off-by: Oleksander Piskun --- lib/Controller/ExAppProxyController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Controller/ExAppProxyController.php b/lib/Controller/ExAppProxyController.php index 800fd5aa..0d0b4b2f 100644 --- a/lib/Controller/ExAppProxyController.php +++ b/lib/Controller/ExAppProxyController.php @@ -318,10 +318,19 @@ private function buildMultipartFormData(array $bodyParams, array $files): array private function passesExAppProxyRoutesChecks(ExApp $exApp, string $exAppRoute): array { // Route URL is a regex matched against the request path including its leading slash, mirroring HaRP's target_path semantics. - $exAppRoute = '/' . $exAppRoute; + $canonicalSubject = '/' . $exAppRoute; foreach ($exApp->getRoutes() as $route) { $pattern = '~^(?:' . str_replace('~', '\\~', $route['url']) . ')~i'; - if (preg_match($pattern, $exAppRoute) === 1 + $matched = preg_match($pattern, $canonicalSubject) === 1; + if (!$matched && preg_match($pattern, $exAppRoute) === 1) { + // TODO(deprecation): remove this bare-path fallback once known ExApps have migrated their info.xml route URLs to the canonical `^/path$` form. Tracked by the AppAPI / context_chat_backend coordination effort. + $this->logger->debug(sprintf( + 'ExApp "%s" matched route "%s" via legacy bare-path fallback. Update the info.xml route URL to start with "/" or "^/" so it matches against "%s".', + $exApp->getAppid(), $route['url'], $canonicalSubject + )); + $matched = true; + } + if ($matched && str_contains(strtolower($route['verb']), strtolower($this->request->getMethod())) ) { // First match by path+verb wins. Apply its access level without falling through to broader routes.