@coffeerunhobby/mcp-ha-connect 2.4.3 → 2.4.5
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/README.md +22 -1
- package/dist/net/adapters/omada.d.ts +71 -0
- package/dist/net/adapters/omada.js +865 -0
- package/dist/net/adapters/omada.js.map +1 -0
- package/dist/net/model.d.ts +415 -0
- package/dist/net/model.js +26 -0
- package/dist/net/model.js.map +1 -0
- package/dist/net/validate.d.ts +22 -0
- package/dist/net/validate.js +87 -0
- package/dist/net/validate.js.map +1 -0
- package/dist/omadaClient/accessControl.js +4 -17
- package/dist/omadaClient/accessControl.js.map +1 -1
- package/dist/omadaClient/index.d.ts +7 -0
- package/dist/omadaClient/index.js +11 -0
- package/dist/omadaClient/index.js.map +1 -1
- package/dist/omadaClient/networkConfig.d.ts +54 -0
- package/dist/omadaClient/networkConfig.js +79 -0
- package/dist/omadaClient/networkConfig.js.map +1 -0
- package/dist/omadaClient/request.d.ts +2 -1
- package/dist/omadaClient/request.js +8 -6
- package/dist/omadaClient/request.js.map +1 -1
- package/dist/tools/common.d.ts +3 -1
- package/dist/tools/common.js +2 -2
- package/dist/tools/common.js.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/net/index.d.ts +125 -0
- package/dist/tools/net/index.js +193 -0
- package/dist/tools/net/index.js.map +1 -0
- package/dist/tools/omada/graph.js +3 -1
- package/dist/tools/omada/graph.js.map +1 -1
- package/dist/utils/ipv4.d.ts +14 -0
- package/dist/utils/ipv4.js +37 -0
- package/dist/utils/ipv4.js.map +1 -0
- package/dist/utils/redact.d.ts +11 -2
- package/dist/utils/redact.js +25 -7
- package/dist/utils/redact.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/utils/redact.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* response is passed through `redactSecrets` (see toToolResult).
|
|
9
9
|
*
|
|
10
10
|
* Only non-empty string values under secret-looking names are replaced, with
|
|
11
|
-
* "<redacted>"
|
|
11
|
+
* "<redacted>" (so are a SIM PIN/PUK and, inside dial-up and VPN sections, account
|
|
12
|
+
* user names): an empty value stays empty (so "is a password set?" is still
|
|
12
13
|
* answerable), and booleans or numbers under similar names (`hidePwd`,
|
|
13
14
|
* `encryptionPsk`) are left alone. `token=` / `access_token=` query values inside
|
|
14
15
|
* URLs are masked as well. The input is never modified.
|
|
@@ -21,16 +22,32 @@ export const REDACTED = '<redacted>';
|
|
|
21
22
|
* Secret-looking field names, matched on the whole name or its ending
|
|
22
23
|
* (case-insensitive), from the Omada Open API and Home Assistant responses.
|
|
23
24
|
*/
|
|
24
|
-
const SECRET_NAME = /(^key$|password|passwd|pwd$|secret|token$|passphrase|presharedkey|privatekey|securitykey|communitystring|^psk$|md5key|simplekey|authcode|devicekey)/i;
|
|
25
|
+
const SECRET_NAME = /(^key$|password|passwd|pwd$|secret|token$|passphrase|presharedkey|privatekey|securitykey|communitystring|^psk$|md5key|simplekey|authcode|devicekey|^(sim)?pin(code)?$|^puk\d?(code)?$)/i;
|
|
26
|
+
/**
|
|
27
|
+
* Account names that identify a subscription (the ISP PPPoE login, the LTE APN
|
|
28
|
+
* user, VPN users). Redacted only inside dial-up and VPN sections, so ordinary
|
|
29
|
+
* names (Home Assistant users, device names) stay readable.
|
|
30
|
+
*/
|
|
31
|
+
const ACCOUNT_NAME = /^(user_?name|username|account)$/i;
|
|
32
|
+
const ACCOUNT_SECTION = /(pppoe|l2tp|pptp|lte|manuallyconfig|apn|dialup|vpn)/i;
|
|
25
33
|
/** Credentials inside URLs, e.g. /api/camera_proxy/camera.door?token=abc123 */
|
|
26
34
|
const URL_SECRET = /([?&](?:access_token|token|key|password|secret)=)[^&#\s"]+/gi;
|
|
27
35
|
export function isSecretName(name) {
|
|
28
36
|
return SECRET_NAME.test(name);
|
|
29
37
|
}
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
/** Whether a name (an object key, or a resource path such as "/vpn/client-to-site/clients") is a dial-up or VPN section. */
|
|
39
|
+
export function isAccountSection(name) {
|
|
40
|
+
return ACCOUNT_SECTION.test(name);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `accountSection`: the value as a whole comes from a dial-up or VPN section (e.g. an
|
|
44
|
+
* unwrapped list of VPN users), so account names are redacted from the top level on.
|
|
45
|
+
*/
|
|
46
|
+
export function redactSecrets(value, options = {}) {
|
|
47
|
+
return redact(value, new WeakSet(), options.accountSection === true);
|
|
32
48
|
}
|
|
33
|
-
|
|
49
|
+
/** `inAccountSection`: an enclosing key names a dial-up or VPN section. */
|
|
50
|
+
function redact(value, seen, inAccountSection) {
|
|
34
51
|
if (typeof value === 'string') {
|
|
35
52
|
return value.includes('=') ? value.replace(URL_SECRET, `$1${REDACTED}`) : value;
|
|
36
53
|
}
|
|
@@ -42,11 +59,12 @@ function redact(value, seen) {
|
|
|
42
59
|
}
|
|
43
60
|
seen.add(value);
|
|
44
61
|
if (Array.isArray(value)) {
|
|
45
|
-
return value.map((item) => redact(item, seen));
|
|
62
|
+
return value.map((item) => redact(item, seen, inAccountSection));
|
|
46
63
|
}
|
|
47
64
|
const out = {};
|
|
48
65
|
for (const [key, field] of Object.entries(value)) {
|
|
49
|
-
|
|
66
|
+
const secret = isSecretName(key) || (inAccountSection && ACCOUNT_NAME.test(key));
|
|
67
|
+
out[key] = typeof field === 'string' && field !== '' && secret ? REDACTED : redact(field, seen, inAccountSection || ACCOUNT_SECTION.test(key));
|
|
50
68
|
}
|
|
51
69
|
return out;
|
|
52
70
|
}
|
package/dist/utils/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/utils/redact.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/utils/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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