@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 +35 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/support/version.ts
|
|
2
2
|
var LIBRARY_NAME = "nodedreame";
|
|
3
|
-
var LIBRARY_VERSION = "1.3.
|
|
3
|
+
var LIBRARY_VERSION = "1.3.1";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -4089,6 +4089,10 @@ var REDACTED = "[redacted]";
|
|
|
4089
4089
|
var SENSITIVE_KEY_FRAGMENTS = [
|
|
4090
4090
|
// identity / secrets
|
|
4091
4091
|
"did",
|
|
4092
|
+
// `deviceid` is listed explicitly: the bare `did` fragment does NOT match
|
|
4093
|
+
// `deviceid` (the substring `did` is absent from `d-e-v-i-c-e-i-d`), yet
|
|
4094
|
+
// base-device sets the real `did` as `deviceId` on raw payloads (FIX 1).
|
|
4095
|
+
"deviceid",
|
|
4092
4096
|
"uid",
|
|
4093
4097
|
"token",
|
|
4094
4098
|
// accessToken, refreshToken, refresh_token, token_type stripped too (safe)
|
|
@@ -4127,14 +4131,24 @@ var SENSITIVE_KEY_FRAGMENTS = [
|
|
|
4127
4131
|
"areaname",
|
|
4128
4132
|
"segmentname",
|
|
4129
4133
|
"segment_name",
|
|
4134
|
+
// room/zone/map names are user-set PII (FIX 3).
|
|
4135
|
+
"zone_name",
|
|
4136
|
+
"zonename",
|
|
4137
|
+
"map_name",
|
|
4138
|
+
"mapname",
|
|
4130
4139
|
// map binary / geometry (location-revealing)
|
|
4131
4140
|
"map_info",
|
|
4132
4141
|
"mapinfo",
|
|
4133
4142
|
"mapblob",
|
|
4134
4143
|
// free-text device names that may carry PII. NOTE: the bare fragment `name` is
|
|
4135
4144
|
// intentionally NOT listed — it would over-match the catalog's command `name`
|
|
4136
|
-
// field (an enum-derived, non-sensitive label).
|
|
4137
|
-
//
|
|
4145
|
+
// field (an enum-derived, non-sensitive label like `START`). ACCEPTED
|
|
4146
|
+
// TRADE-OFF: a bare `{ name: "..." }` in an event argument is NOT scrubbed by
|
|
4147
|
+
// key. This is mitigated in practice by (a) the value-sanitizer below
|
|
4148
|
+
// (sanitizeStringValue, applied to EVERY string scalar — it catches OSS
|
|
4149
|
+
// paths / URLs / tokens regardless of key), and (b) the specific
|
|
4150
|
+
// customName/deviceName/nickName/zoneName/mapName fragments which cover the
|
|
4151
|
+
// realistic PII-bearing name cases.
|
|
4138
4152
|
"customname",
|
|
4139
4153
|
"devicename",
|
|
4140
4154
|
"nickname"
|
|
@@ -4150,6 +4164,21 @@ function isSensitiveKey(key2) {
|
|
|
4150
4164
|
function isPlainObject(v) {
|
|
4151
4165
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4152
4166
|
}
|
|
4167
|
+
var RISKY_VALUE_PATTERNS = [
|
|
4168
|
+
/:\/\//,
|
|
4169
|
+
// any URL scheme (https://, mqtts://, …) — signed URLs carry tokens
|
|
4170
|
+
/ali_dreame\//i,
|
|
4171
|
+
// OSS object path embedding uid/did
|
|
4172
|
+
/[A-Za-z0-9_-]{32,}/,
|
|
4173
|
+
// a long opaque token run (base64/hex secrets)
|
|
4174
|
+
/\b(did|uid|token)\s*=/i,
|
|
4175
|
+
// query-param secrets (?did=…&token=…)
|
|
4176
|
+
/access/i
|
|
4177
|
+
// accessKey / access-token / x-access-key style markers
|
|
4178
|
+
];
|
|
4179
|
+
function sanitizeStringValue(s) {
|
|
4180
|
+
return RISKY_VALUE_PATTERNS.some((re) => re.test(s)) ? REDACTED : s;
|
|
4181
|
+
}
|
|
4153
4182
|
function redact(value) {
|
|
4154
4183
|
if (Array.isArray(value)) {
|
|
4155
4184
|
return value.map((v) => redact(v));
|
|
@@ -4161,6 +4190,9 @@ function redact(value) {
|
|
|
4161
4190
|
}
|
|
4162
4191
|
return out;
|
|
4163
4192
|
}
|
|
4193
|
+
if (typeof value === "string") {
|
|
4194
|
+
return sanitizeStringValue(value);
|
|
4195
|
+
}
|
|
4164
4196
|
return value;
|
|
4165
4197
|
}
|
|
4166
4198
|
|