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

Doing topic checking also in publish requests #190

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jacoposartini
Copy link

@jacoposartini jacoposartini commented Oct 29, 2019

I am working on a Django project which consists of a platform for remote control of IoT devices.
To integrate MQTT with the database I wrote a plugin in order to limit the access of users only to the topics to which they are authorized.
When doing some tests I realized that the topic checking is only performed in the sub requests, while in the pub requests anyone can publish in the topics reserved for other users.
Looking at the code in broker.py I found that the method topic_filtering() is called only in the sub requests.
To solve this problem I added a method that calls the topic filtering in the pub requests that come from the users.

@coveralls
Copy link

coveralls commented Oct 29, 2019

Coverage Status

Coverage remained the same at ?% when pulling c505741 on jacoposartini:master into fc462d1 on beerfactory:master.

@romancardenas
Copy link
Contributor

I find this update very useful! Thank you

@ntoonio
Copy link
Contributor

ntoonio commented Nov 28, 2019

I was really surprised when I tried it a while ago and realized that it didn't check on publish. I would definitely use this feature!

However I think the plugin needs to be able to differentiate between publish and subscribe, to allow more advanced rules, for example if someone should be able to read from a topic but not publish to it.
I implemented that feature, but I don't know how I propose that change in this pull request. Should I create new pull request when this has been merged? For now it's available at https://github.com/ntoonio/hbmqtt/tree/pull_190

@romancardenas
Copy link
Contributor

I suggest you fork @jacoposartini repo, make the changes and start a new pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants