Skip to content

Commit ddcfd3a

Browse files
csu333Claude Sonnet 4.6
andcommitted
refactor(mqtt): replace crypto hash with plain broker URL + username key
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 83967d2 commit ddcfd3a

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

server/monitor-types/mqtt.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { MonitorType } = require("./monitor-type");
22
const { log, UP } = require("../../src/util");
33
const mqtt = require("mqtt");
4-
const { createHash } = require("crypto");
54
const jsonata = require("jsonata");
65
const { ConditionVariable } = require("../monitor-conditions/variables");
76
const { defaultStringOperators, defaultNumberOperators } = require("../monitor-conditions/operators");
@@ -228,10 +227,7 @@ class MqttMonitorType extends MonitorType {
228227
}
229228
}
230229

231-
// Key shared connections by broker URL + credentials (hashed to avoid storing plaintext credentials)
232-
const connectionKey = createHash("sha256")
233-
.update(`${mqttUrl}\x00${username ?? ""}\x00${password ?? ""}`)
234-
.digest("hex");
230+
const connectionKey = `${mqttUrl}\x00${username ?? ""}`;
235231

236232
// If this monitor previously used a different broker or topic, release the old subscription
237233
const prevState = this.monitorStates.get(monitorId);

0 commit comments

Comments
 (0)