diff --git a/apps/sim/middleware.ts b/apps/sim/middleware.ts index 1a7f9ea498..6e958c91d1 100644 --- a/apps/sim/middleware.ts +++ b/apps/sim/middleware.ts @@ -99,8 +99,14 @@ export async function middleware(request: NextRequest) { } const userAgent = request.headers.get('user-agent') || '' + + // Check if this is a webhook endpoint that should be exempt from User-Agent validation + const isWebhookEndpoint = url.pathname.startsWith('/api/webhooks/trigger/') + const isSuspicious = SUSPICIOUS_UA_PATTERNS.some((pattern) => pattern.test(userAgent)) - if (isSuspicious) { + + // Block suspicious requests, but exempt webhook endpoints from User-Agent validation only + if (isSuspicious && !isWebhookEndpoint) { logger.warn('Blocked suspicious request', { userAgent, ip: request.headers.get('x-forwarded-for') || 'unknown',