@adea-ai/telemetry 4.1.3 → 4.2.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.
- package/dist/redaction.js +15 -4
- package/package.json +2 -1
package/dist/redaction.js
CHANGED
|
@@ -100,7 +100,7 @@ function redact(value, seen) {
|
|
|
100
100
|
else {
|
|
101
101
|
const record = {};
|
|
102
102
|
for (const [key, nested] of Object.entries(value)) {
|
|
103
|
-
record
|
|
103
|
+
setOwn(record, key, isSensitiveKey(key) ? '[REDACTED]' : redact(nested, seen));
|
|
104
104
|
}
|
|
105
105
|
result = record;
|
|
106
106
|
}
|
|
@@ -111,14 +111,25 @@ export function sanitizeAttributes(attributes) {
|
|
|
111
111
|
const sanitized = {};
|
|
112
112
|
for (const [key, value] of Object.entries(attributes)) {
|
|
113
113
|
if (isSensitiveKey(key))
|
|
114
|
-
sanitized
|
|
114
|
+
setOwn(sanitized, key, '[REDACTED]');
|
|
115
115
|
else if (typeof value === 'boolean' || typeof value === 'number')
|
|
116
|
-
sanitized
|
|
116
|
+
setOwn(sanitized, key, value);
|
|
117
117
|
else if (typeof value === 'string')
|
|
118
|
-
sanitized
|
|
118
|
+
setOwn(sanitized, key, redactText(value));
|
|
119
119
|
}
|
|
120
120
|
return sanitized;
|
|
121
121
|
}
|
|
122
|
+
function setOwn(record, key, value) {
|
|
123
|
+
if (key === '__proto__')
|
|
124
|
+
Object.defineProperty(record, key, {
|
|
125
|
+
value,
|
|
126
|
+
enumerable: true,
|
|
127
|
+
writable: true,
|
|
128
|
+
configurable: true,
|
|
129
|
+
});
|
|
130
|
+
else
|
|
131
|
+
record[key] = value;
|
|
132
|
+
}
|
|
122
133
|
const diagnosticRedactedValue = '[REDACTED]';
|
|
123
134
|
const diagnosticCircularValue = '[Circular]';
|
|
124
135
|
const diagnosticSensitiveKey = /authorization|cookie|credential|password|private.?key|secret|token|api.?key/i;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/telemetry",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Fail-open observability toolkit: structured logging, secret redaction, trace-context propagation, deterministic sampling, and pluggable OpenTelemetry, Sentry, and LangSmith adapters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langsmith",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
26
27
|
"browser": false,
|
|
27
28
|
"types": "./dist/index.d.ts",
|
|
28
29
|
"exports": {
|