RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
244 stars 215 forks source link

SMS Interpreter sends Parser special characters it cannot handle. Parser never recovers #2864

Open abdulazizali77 opened 6 years ago

abdulazizali77 commented 6 years ago

/kind bug

What happened: Sending special character to SMS app causes Parser error. Parser does not recover and keeps retrying

What you expected to happen: Special characters which cnnot be handled should be sanitized at Interpreter level before passing to Parser or Parser should probably try once and fail and not keep retrying

How to reproduce it (as minimally and precisely as possible): -Create an SMS app similar to this https://staging.restcomm.com/restcomm-rvd/#/designer/AP0c347f2944a34721bb576eb73f438dd9

<Response>
<Sms to="" from="">echo: $core_Body</Sms>
</Response>

-assign app to number -send SMS to number with message ` or ç

Anything else we need to know?:

05:44:46,285 DEBUG [org.restcomm.connect.interpreter.rcml.Parser] (RestComm-akka.actor.default-dispatcher-7495) About to create new Parser for xml: <Response>
  <Sms to="60182389459" from="12017309916">echo: test no core body2</Sms>
  <Email to="" from="" cc="" subject="subject: test">test2 &#x0;�&#x0;`</Email>
</Response>
05:44:46,285 ERROR [akka.actor.ActorCell] (RestComm-akka.actor.default-dispatcher-7497) error while processing Resume(da83f15d-91e5-4c7f-a640-8506d678b555akka.actor.ActorInitializationException: exception during creation): 6243c45d-31c6-4ae7-b806-3275dc92b3a8akka.actor.ActorInitializationException: exception during creation
        at akka.actor.ActorInitializationException$.apply(Actor.scala:170) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.ActorCell.create(ActorCell.scala:496) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.dungeon.FaultHandling$class.finishCreate(FaultHandling.scala:137) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.dungeon.FaultHandling$class.faultCreate(FaultHandling.scala:131) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.ActorCell.faultCreate(ActorCell.scala:306) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.dungeon.FaultHandling$class.faultResume(FaultHandling.scala:103) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.ActorCell.faultResume(ActorCell.scala:306) [akka-actor_2.10-2.1.2.jar:]
        at akka.actor.ActorCell.systemInvoke(ActorCell.scala:366) [akka-actor_2.10-2.1.2.jar:]
        at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:256) [akka-actor_2.10-2.1.2.jar:]
        at akka.dispatch.Mailbox.run(Mailbox.scala:211) [akka-actor_2.10-2.1.2.jar:]
        at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.2.jar:]
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) [scala-library-2.10.1.jar:]
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [scala-library-2.10.1.jar:]
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) [scala-library-2.10.1.jar:]
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [scala-library-2.10.1.jar:]
Caused by: [com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxParsingException: Invalid character reference: null character not allowed in XML content.

Environment: staging environment 8.3.0-190

nhanth87 commented 6 years ago

it's character that terminated the xml, we need to encode the character to some utf-8 or unicode hex numebr

nhanth87 commented 6 years ago

I mean "`"

abdulazizali77 commented 6 years ago

The dcs in the incoming SMS doesnt set it to UTF-8

abdulazizali77 commented 6 years ago

This will be fixed by https://github.com/RestComm/Restcomm-Connect/pull/2863