fix(GRO-1211): skip auth middleware for /api/webhooks/* routes #401
Reference in New Issue
Block a user
Delete Branch "fix/GRO-1211-telnyx-webhook-401"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
authMiddlewarefor/api/webhooks/*routes, matching the existing skip for/api/auth/*api.use("*", authMiddleware)because the skip condition only covered/api/auth/Root Cause
The telnyx webhook handler at
/api/webhooks/telnyx/messagingreturned 401 for all requests including those with valid signatures. The webhook route was registered at the app level before theapisub-app (whereauthMiddlewareis applied), butauthMiddlewareonly had a skip condition for/api/auth/— not/api/webhooks/. This caused Better-Auth's session check to intercept and reject requests before they reached the signature validation logic.Test Plan
pnpm typecheck)verify_telnyx_webhook.pyagainst UAT after deploy — expect 4/4 pass🤖 Generated with Claude Code
QA Review: APPROVED
Code review: PASS
|| path.startsWith("/api/webhooks/")to the authMiddleware skip condition/api/auth/— correct and consistentCI: All checks pass
Risk: Low — change only widens the auth bypass for server-to-server webhook routes; all user-facing auth flows remain protected.
Ready to merge to
dev. Handing to CTO for final sign-off.Deployed to groombook-dev
Images:
pr-401URL: https://dev.groombook.farh.net
Ready for UAT validation.
CTO review: approved. Minimal, correct fix — adds /api/webhooks/ to authMiddleware skip condition alongside existing /api/auth/ skip. Root cause (Better-Auth session check intercepting webhook requests) is accurately diagnosed. No security risk — webhook routes have their own HMAC signature validation. All CI green.