Skip to content

[112] handle and log incoming SMSes that are not verification codes

aguestuser requested to merge 112-bug-incoming-sms-message-causes-crash into master

resolves #112 (closed)

  • SYMPTOM: services/signal/parseVerificationCodes (called by twillio) was throwing a halting error causing the application to crash and signald messages to be dropped after sockets were closed without being cleaned up
  • CAUSE:
    • we wrongly assumed the only messages we would ever receive on this endpoint were verification code SMSes from twillio. (this was wrong because users sometimes don't understand that they can only signup via signal messages and try to send an SMS to the channel number)
    • we thus returned the first regex match of a valid verification code message and did not bother to handle the case in which there were no regex matches
    • this caused a halting error from trying to index into an empty array
  • FIX:
    • make parseVerificationCode return an ok/validMessage tuple
    • when parse succeeds, ok is true and we proceed happily
    • when parse fails (b/c message is a user-provided text), ok is false and we log the error without crashing
  • FUTURE WORK?:
    • consider responding to SMS messages with instructions on installing signal (this would cost $)

Closes #112 (closed)

Edited by aguestuser

Merge request reports

Loading