Skip to content

Commit 00f893e

Browse files
authored
fix(telegram-middleware): modified middleware to not check for user-agent on webhook
fix(telegram-middleware): modified middleware to not check for user-agent on webhook
1 parent 567f7a5 commit 00f893e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/sim/middleware.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ export async function middleware(request: NextRequest) {
9999
}
100100

101101
const userAgent = request.headers.get('user-agent') || ''
102+
103+
// Check if this is a webhook endpoint that should be exempt from User-Agent validation
104+
const isWebhookEndpoint = url.pathname.startsWith('/api/webhooks/trigger/')
105+
102106
const isSuspicious = SUSPICIOUS_UA_PATTERNS.some((pattern) => pattern.test(userAgent))
103-
if (isSuspicious) {
107+
108+
// Block suspicious requests, but exempt webhook endpoints from User-Agent validation only
109+
if (isSuspicious && !isWebhookEndpoint) {
104110
logger.warn('Blocked suspicious request', {
105111
userAgent,
106112
ip: request.headers.get('x-forwarded-for') || 'unknown',

0 commit comments

Comments
 (0)