@apocaliss92/nodedreame 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -69,7 +69,7 @@ module.exports = __toCommonJS(index_exports);
69
69
 
70
70
  // src/support/version.ts
71
71
  var LIBRARY_NAME = "nodedreame";
72
- var LIBRARY_VERSION = "1.3.0";
72
+ var LIBRARY_VERSION = "1.3.1";
73
73
 
74
74
  // src/transport/errors.ts
75
75
  var DreameError = class extends Error {
@@ -4158,6 +4158,10 @@ var REDACTED = "[redacted]";
4158
4158
  var SENSITIVE_KEY_FRAGMENTS = [
4159
4159
  // identity / secrets
4160
4160
  "did",
4161
+ // `deviceid` is listed explicitly: the bare `did` fragment does NOT match
4162
+ // `deviceid` (the substring `did` is absent from `d-e-v-i-c-e-i-d`), yet
4163
+ // base-device sets the real `did` as `deviceId` on raw payloads (FIX 1).
4164
+ "deviceid",
4161
4165
  "uid",
4162
4166
  "token",
4163
4167
  // accessToken, refreshToken, refresh_token, token_type stripped too (safe)
@@ -4196,14 +4200,24 @@ var SENSITIVE_KEY_FRAGMENTS = [
4196
4200
  "areaname",
4197
4201
  "segmentname",
4198
4202
  "segment_name",
4203
+ // room/zone/map names are user-set PII (FIX 3).
4204
+ "zone_name",
4205
+ "zonename",
4206
+ "map_name",
4207
+ "mapname",
4199
4208
  // map binary / geometry (location-revealing)
4200
4209
  "map_info",
4201
4210
  "mapinfo",
4202
4211
  "mapblob",
4203
4212
  // free-text device names that may carry PII. NOTE: the bare fragment `name` is
4204
4213
  // intentionally NOT listed — it would over-match the catalog's command `name`
4205
- // field (an enum-derived, non-sensitive label). The specific custom-name
4206
- // fields below cover every PII-bearing case.
4214
+ // field (an enum-derived, non-sensitive label like `START`). ACCEPTED
4215
+ // TRADE-OFF: a bare `{ name: "..." }` in an event argument is NOT scrubbed by
4216
+ // key. This is mitigated in practice by (a) the value-sanitizer below
4217
+ // (sanitizeStringValue, applied to EVERY string scalar — it catches OSS
4218
+ // paths / URLs / tokens regardless of key), and (b) the specific
4219
+ // customName/deviceName/nickName/zoneName/mapName fragments which cover the
4220
+ // realistic PII-bearing name cases.
4207
4221
  "customname",
4208
4222
  "devicename",
4209
4223
  "nickname"
@@ -4219,6 +4233,21 @@ function isSensitiveKey(key2) {
4219
4233
  function isPlainObject(v) {
4220
4234
  return typeof v === "object" && v !== null && !Array.isArray(v);
4221
4235
  }
4236
+ var RISKY_VALUE_PATTERNS = [
4237
+ /:\/\//,
4238
+ // any URL scheme (https://, mqtts://, …) — signed URLs carry tokens
4239
+ /ali_dreame\//i,
4240
+ // OSS object path embedding uid/did
4241
+ /[A-Za-z0-9_-]{32,}/,
4242
+ // a long opaque token run (base64/hex secrets)
4243
+ /\b(did|uid|token)\s*=/i,
4244
+ // query-param secrets (?did=…&token=…)
4245
+ /access/i
4246
+ // accessKey / access-token / x-access-key style markers
4247
+ ];
4248
+ function sanitizeStringValue(s) {
4249
+ return RISKY_VALUE_PATTERNS.some((re) => re.test(s)) ? REDACTED : s;
4250
+ }
4222
4251
  function redact(value) {
4223
4252
  if (Array.isArray(value)) {
4224
4253
  return value.map((v) => redact(v));
@@ -4230,6 +4259,9 @@ function redact(value) {
4230
4259
  }
4231
4260
  return out;
4232
4261
  }
4262
+ if (typeof value === "string") {
4263
+ return sanitizeStringValue(value);
4264
+ }
4233
4265
  return value;
4234
4266
  }
4235
4267