Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-826

MQTT with a long password field causes NPE exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.4.0, 1.5.0
    • 2.1.0
    • None

    Description

      Hi
      I'm using mqtt.js and Paho (java) as client for MQTT protocol.
      The issue can be replicated both on (my embed) version pointing at master (1.5.0-SNAPSHOT) and with a clean install of 1.4.0 release

      Happens by using a long password (a jwt token in my case) which causes this exception on both versions

      Example password:
      eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNDc3NDg1NDc5OTEzLCJleHAiOjE0Nzc0ODcyNzksInV1aWQiOiI2NmVkNDc3Mi0wNDg5LTRlOTYtYmI2NS01NDhiMmVkMmM3MWQifQ.LbOAr8pPApDlVBLi32JWtCjmCa80ByAJYq9BnTnWQgh4SWka4WzykMU0D_atE5tYtgICj2QOg-OFglv2ZqLLNw

      Exception:
      Caused by: java.lang.NullPointerException
      at org.apache.activemq.artemis.core.protocol.ProtocolHandler$ProtocolDecoder.decode(ProtocolHandler.java:185) [artemis-server-1.4.0.jar:1.4.0]

      Looking at the source Artemis receive a different set of bytes ("M"QTT starts at array[5])

      https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java#L131

      MQTT spec on password length (0 to 65535 bytes of binary data + 2bytes for length)

      http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349246

      Client code is here:
      https://gist.github.com/muka/df7cac712a645b9f1895274adcbe3670

      Embed artemis code is here:
      https://github.com/muka/raptor/tree/master/raptor-broker

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              martyntaylor Martyn Taylor
              lcapra luca capra
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: