Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty strings are considered as valid topic #595

Open
ThejasKiranPS opened this issue Mar 26, 2023 · 3 comments · May be fixed by #813
Open

Empty strings are considered as valid topic #595

ThejasKiranPS opened this issue Mar 26, 2023 · 3 comments · May be fixed by #813
Assignees
Labels
bug Something isn't working

Comments

@ThejasKiranPS
Copy link

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

Topic semantic and usage

There is also a size limit and a null-character rule which I think is also not checked for.

@ThejasKiranPS
Copy link
Author

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?

@h3nill h3nill added the bug Something isn't working label Apr 3, 2023
@arunanshub arunanshub self-assigned this Jan 19, 2024
@AlexandreCassagne
Copy link
Contributor

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?

The use of a Topic type which handles validation at construction only is the way to go, IMO!

@swanandx
Copy link
Member

swanandx commented Mar 6, 2024

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?

@arunanshub arunanshub linked a pull request Mar 6, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants