@channel.io/app-sdk-server 0.32.0 → 0.34.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-for-logging.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize-for-logging.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitize-for-logging.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize-for-logging.ts"],"names":[],"mappings":"AAkDA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,kBAAgB,GAAG,OAAO,CA6B9F"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const REDACTED_LOG_VALUE = "[REDACTED]";
|
|
2
2
|
const CIRCULAR_LOG_VALUE = "[Circular]";
|
|
3
3
|
const OAUTH_FLOW_NONCE_NAME = /oauth[-_ +]?flow[-_ +]?nonce/i;
|
|
4
|
+
// Match the opening boundary too: truncated or escaped PEM must never be logged.
|
|
5
|
+
const PRIVATE_KEY_BOUNDARY = /-----BEGIN[ +](?:[A-Z0-9]+[ +])*PRIVATE[ +]KEY-----/i;
|
|
4
6
|
const SENSITIVE_LOG_KEYS = new Set([
|
|
5
7
|
"secret",
|
|
6
8
|
"appsecret",
|
|
@@ -13,6 +15,7 @@ const SENSITIVE_LOG_KEYS = new Set([
|
|
|
13
15
|
"authorization",
|
|
14
16
|
"clientsecret",
|
|
15
17
|
"password",
|
|
18
|
+
"privatekey",
|
|
16
19
|
"xaccesstoken",
|
|
17
20
|
"resumeurl",
|
|
18
21
|
"resumenonce",
|
|
@@ -21,9 +24,9 @@ const SENSITIVE_LOG_KEYS = new Set([
|
|
|
21
24
|
function normalizeSensitiveLogKey(key) {
|
|
22
25
|
return key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
23
26
|
}
|
|
24
|
-
function
|
|
27
|
+
function shouldRedactSensitiveString(value) {
|
|
25
28
|
for (let depth = 0; depth < 4; depth++) {
|
|
26
|
-
if (OAUTH_FLOW_NONCE_NAME.test(value)) {
|
|
29
|
+
if (OAUTH_FLOW_NONCE_NAME.test(value) || PRIVATE_KEY_BOUNDARY.test(value)) {
|
|
27
30
|
return true;
|
|
28
31
|
}
|
|
29
32
|
// Decode bytes only for detection; malformed escapes must not stop masking.
|
|
@@ -34,24 +37,26 @@ function shouldRedactOAuthFlowURL(value) {
|
|
|
34
37
|
value = decoded;
|
|
35
38
|
}
|
|
36
39
|
// Bound work for deeply nested redirects and hide values we cannot fully inspect.
|
|
37
|
-
return OAUTH_FLOW_NONCE_NAME.test(value) ||
|
|
40
|
+
return (OAUTH_FLOW_NONCE_NAME.test(value) ||
|
|
41
|
+
PRIVATE_KEY_BOUNDARY.test(value) ||
|
|
42
|
+
/%[0-9a-f]{2}/i.test(value));
|
|
38
43
|
}
|
|
39
44
|
export function sanitizeForLogging(value, key, seen = new WeakSet()) {
|
|
40
45
|
if (key && SENSITIVE_LOG_KEYS.has(normalizeSensitiveLogKey(key))) {
|
|
41
46
|
return REDACTED_LOG_VALUE;
|
|
42
47
|
}
|
|
43
|
-
//
|
|
44
|
-
if (typeof value === "string" &&
|
|
48
|
+
// Sensitive material can appear inside a serialized config or an encoded URL.
|
|
49
|
+
if (typeof value === "string" && shouldRedactSensitiveString(value)) {
|
|
45
50
|
return REDACTED_LOG_VALUE;
|
|
46
51
|
}
|
|
47
|
-
if (Array.isArray(value)) {
|
|
48
|
-
return value.map((item) => sanitizeForLogging(item, undefined, seen));
|
|
49
|
-
}
|
|
50
52
|
if (value && typeof value === "object") {
|
|
51
53
|
if (seen.has(value)) {
|
|
52
54
|
return CIRCULAR_LOG_VALUE;
|
|
53
55
|
}
|
|
54
56
|
seen.add(value);
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
return value.map((item) => sanitizeForLogging(item, undefined, seen));
|
|
59
|
+
}
|
|
55
60
|
return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [
|
|
56
61
|
entryKey,
|
|
57
62
|
sanitizeForLogging(entryValue, entryKey, seen),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-for-logging.js","sourceRoot":"","sources":["../../src/utils/sanitize-for-logging.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,qBAAqB,GAAG,+BAA+B,CAAC;AAC9D,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,QAAQ;IACR,WAAW;IACX,cAAc;IACd,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,QAAQ;IACR,eAAe;IACf,cAAc;IACd,UAAU;IACV,cAAc;IACd,WAAW;IACX,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAC;AAEH,SAAS,wBAAwB,CAAC,GAAW;IAC3C,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,
|
|
1
|
+
{"version":3,"file":"sanitize-for-logging.js","sourceRoot":"","sources":["../../src/utils/sanitize-for-logging.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,qBAAqB,GAAG,+BAA+B,CAAC;AAC9D,iFAAiF;AACjF,MAAM,oBAAoB,GAAG,sDAAsD,CAAC;AACpF,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,QAAQ;IACR,WAAW;IACX,cAAc;IACd,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,QAAQ;IACR,eAAe;IACf,cAAc;IACd,UAAU;IACV,YAAY;IACZ,cAAc;IACd,WAAW;IACX,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAC;AAEH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5B,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEhB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC;YACpD,QAAQ;YACR,kBAAkB,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC;SAC/C,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@channel.io/app-sdk-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "NestJS server SDK for Channel.io apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@channel.io/app-sdk-core": "0.34.0",
|
|
24
25
|
"@grpc/grpc-js": "^1.14.4",
|
|
25
26
|
"protobufjs": "^8.7.1",
|
|
26
27
|
"zod": "^3.24.1",
|
|
27
|
-
"zod-to-json-schema": "^3.25.2"
|
|
28
|
-
"@channel.io/app-sdk-core": "0.32.0"
|
|
28
|
+
"zod-to-json-schema": "^3.25.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@google-cloud/bigquery": "^8.3.1",
|