Skip to content

fix(twilio): reject malformed webhook signatures#57

Open
rissrice2105-agent wants to merge 1 commit into
profullstack:masterfrom
rissrice2105-agent:fix/twilio-malformed-signature
Open

fix(twilio): reject malformed webhook signatures#57
rissrice2105-agent wants to merge 1 commit into
profullstack:masterfrom
rissrice2105-agent:fix/twilio-malformed-signature

Conversation

@rissrice2105-agent

Copy link
Copy Markdown

Summary

  • reject malformed Twilio webhook signatures without throwing
  • preserve constant-time comparison for signatures with valid lengths
  • add regression coverage for truncated signature headers

Bug

Node's crypto.timingSafeEqual throws when the two buffers have different lengths. A malformed X-Twilio-Signature therefore escaped validation and turned an invalid webhook into a 500 response instead of returning false so the route can reject it with 403.

Tests

  • corepack pnpm test (24 files, 111 tests)
  • corepack pnpm typecheck
  • corepack pnpm lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant