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

Deny ACL check for deleted MQTT Clients #4766

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions forge/comms/v2AuthRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,22 @@ module.exports = async function (app) {
if (app.license.active()) {
const parts = request.body.username.split('@')
const user = await app.db.models.TeamBrokerClient.byUsername(parts[0], parts[1])
const acls = JSON.parse(user.acls)
for (const acl in acls) {
if (request.body.action === 'subscribe') {
if (mqttMatch(acls[acl].pattern, request.body.topic)) {
if (acls[acl].action === 'both' || acls[acl].action === 'subscribe') {
reply.send({ result: 'allow' })
return
if (user) {
const acls = JSON.parse(user.acls)
for (const acl in acls) {
if (request.body.action === 'subscribe') {
if (mqttMatch(acls[acl].pattern, request.body.topic)) {
if (acls[acl].action === 'both' || acls[acl].action === 'subscribe') {
reply.send({ result: 'allow' })
return
}
}
}
} else {
if (mqttMatch(acls[acl].pattern, request.body.topic)) {
if (acls[acl].action === 'both' || acls[acl].action === 'publish') {
reply.send({ result: 'allow' })
return
} else {
if (mqttMatch(acls[acl].pattern, request.body.topic)) {
if (acls[acl].action === 'both' || acls[acl].action === 'publish') {
reply.send({ result: 'allow' })
return
}
}
}
}
Expand Down
Loading