twilio / twilio/twilio-ruby

When there is an apostrophe in the body the validation of the webhook fails

Open
#528 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: help wanted type: bug
Dominant language
Ruby
Stars
1.4k
Forks
472
Avg merge
1d 3h
Merged PRs (30d)
5

Description

Issue Summary

An apostrophe in the body of a text message causes validation of Twilio webhook to fail

Steps to Reproduce
  1. Send a text message with an apostrophe in it
  2. try to validate the incoming webhook
Code Snippet
    twilio_signature = env["HTTP_X_TWILIO_SIGNATURE"]
        url = "#{rack_request.scheme}://" + env["HTTP_HOST"] + env["REQUEST_URI"]
        unless validator.validate(url, {}, twilio_signature)
          raise "Twilio request validation failed."
        end
Technical details:
  • twilio-ruby version: 5.40.0 (also fails with 5.37.0)
  • ruby version: 2.7.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the validator.validate call shown in the issue and reproduce webhook validation with a message containing an apostrophe. Trace the signature-validation path and verify that the same request validates successfully once the bug is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.