rumqtt
                                
                                 rumqtt copied to clipboard
                                
                                    rumqtt copied to clipboard
                            
                            
                            
                        Empty strings are considered as valid topic
Expected Behavior
Publishing or Subscribing to an empty-string-topic should throw an error.
Current Behavior
Allows the usage of empty string as topic.
References
There is also a size limit and a null-character rule which I think is also not checked for.
We could create a Topic struct which runs all these checks when a new topic is being created (Topic::new(&str))
or manually check with fn valid_topic() everywhere. Is there a better way to do this?
We could create a
Topicstruct which runs all these checks when a new topic is being created (Topic::new(&str))or manually check with
fn valid_topic()everywhere. Is there a better way to do this?
The use of a Topic type which handles validation at construction only is the way to go, IMO!
The use of a Topic type which handles validation at construction only is the way to go, IMO!
agree, but topic/filter needs to be validated only once!
in rumqttc, when we call publish / subscribe. in rumqttd, when publish/subscribe packet is received and being handled.
So we have to think on pros/cons of using Topic. also, we just need to add some more checks like length and null byte in validate_topic fn and this should resolve the issue as well right?