From cb409f0286bbde5f05a08fa6680fa2414a89029c Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Thu, 19 Jul 2018 10:53:54 -0500 Subject: [PATCH] Update allowed MQTT channel regex --- app/controllers/api/rmq_utils_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/rmq_utils_controller.rb b/app/controllers/api/rmq_utils_controller.rb index 8ec7a1e769..3832bbbf2f 100644 --- a/app/controllers/api/rmq_utils_controller.rb +++ b/app/controllers/api/rmq_utils_controller.rb @@ -7,7 +7,8 @@ module Api class RmqUtilsController < Api::AbstractController # The only valid format for AMQP / MQTT topics. # Prevents a whole host of abuse / security issues. - TOPIC_REGEX = /(bot\.device_)\d*\.(from_clients|from_device|logs|status|sync|resources_v0|from_api)\.?.*/ + TOPIC_REGEX = \ + /(bot\.device_)\d*\.(from_clients|from_device|logs|status|sync|resources_v0|from_api)\.?.*/ MALFORMED_TOPIC = "malformed topic. Must match #{TOPIC_REGEX.inspect}" ALL = [:user, :vhost, :resource, :topic] VHOST = ENV.fetch("MQTT_VHOST") { "/" }