Skip to content

Commit 8db2923

Browse files
Fix/webchat authorized domain fail closed (#1028)
* fix(webchat): fail closed when no authorized domains are configured isOriginAuthorized previously allowed any origin when authorizedDomains was empty, letting the webchat widget be embedded on unintended sites before the allow-list was ever configured. Reject cross-origin embeds in that case; a missing origin (direct, non-embedded access) is still allowed. * fix(webchat): restore /webchat as a public route in proxy middleware /webchat was excluded from the negative-lookahead matcher instead of being listed in publicRoutes, so it never reached the auth check but also picked up no session/tenant handling from proxy(). Move it into publicRoutes and drop it from the matcher exclusion so it goes through the same public-route path as the other unauthenticated surfaces (booking, portal/redeem, etc).
1 parent 22163bc commit 8db2923

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/builder/src/proxy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const publicRoutes = [
2525
"/extensions",
2626
"/booking",
2727
"/portal/redeem",
28+
"/webchat",
2829
]
2930
const signinPath = "/auth/sign-in"
3031

@@ -118,7 +119,7 @@ function isPublicRoute(pathname: string) {
118119

119120
export const config = {
120121
matcher: [
121-
"/((?!webchat|zalo_verifier|pricing|chat-widget|assets|ws|storage|_next/static|_next/image|favicon.ico|avatars|.*.svg|brand|openapi.json|dynamic-image/).*)",
122+
"/((?!zalo_verifier|pricing|chat-widget|assets|ws|storage|_next/static|_next/image|favicon.ico|avatars|.*.svg|brand|openapi.json|dynamic-image/).*)",
122123
"/api/presigned-upload",
123124
"/api/whatsapp/:path*",
124125
],

0 commit comments

Comments
 (0)