@spfn/monitor 0.1.0-beta.21 → 0.1.0-beta.22
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/server.js +43 -2
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
package/dist/server.js
CHANGED
|
@@ -3290,6 +3290,45 @@ var monitorRouter = defineRouter({
|
|
|
3290
3290
|
|
|
3291
3291
|
// src/server/integrations/error-handler.ts
|
|
3292
3292
|
import { getMinStatusCode } from "@spfn/monitor/config";
|
|
3293
|
+
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([
|
|
3294
|
+
"authorization",
|
|
3295
|
+
"proxy-authorization",
|
|
3296
|
+
"cookie",
|
|
3297
|
+
"set-cookie",
|
|
3298
|
+
"x-api-key",
|
|
3299
|
+
"x-auth-token",
|
|
3300
|
+
"x-csrf-token",
|
|
3301
|
+
"x-xsrf-token",
|
|
3302
|
+
"x-spfn-proxy-signature",
|
|
3303
|
+
"x-amz-security-token"
|
|
3304
|
+
]);
|
|
3305
|
+
var SENSITIVE_QUERY = /* @__PURE__ */ new Set([
|
|
3306
|
+
"token",
|
|
3307
|
+
"access_token",
|
|
3308
|
+
"refresh_token",
|
|
3309
|
+
"id_token",
|
|
3310
|
+
"code",
|
|
3311
|
+
"secret",
|
|
3312
|
+
"client_secret",
|
|
3313
|
+
"password",
|
|
3314
|
+
"passwd",
|
|
3315
|
+
"pwd",
|
|
3316
|
+
"api_key",
|
|
3317
|
+
"apikey",
|
|
3318
|
+
"key",
|
|
3319
|
+
"signature",
|
|
3320
|
+
"sig",
|
|
3321
|
+
"session",
|
|
3322
|
+
"sessionid",
|
|
3323
|
+
"auth"
|
|
3324
|
+
]);
|
|
3325
|
+
function redact(obj, deny) {
|
|
3326
|
+
const out = {};
|
|
3327
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
3328
|
+
out[k] = deny.has(k.toLowerCase()) ? "***" : v;
|
|
3329
|
+
}
|
|
3330
|
+
return out;
|
|
3331
|
+
}
|
|
3293
3332
|
var logger4 = monitorLogger.errorTracking;
|
|
3294
3333
|
function createMonitorErrorHandler(options = {}) {
|
|
3295
3334
|
return async (err, ctx) => {
|
|
@@ -3303,8 +3342,10 @@ function createMonitorErrorHandler(options = {}) {
|
|
|
3303
3342
|
method: ctx.method,
|
|
3304
3343
|
requestId: ctx.requestId,
|
|
3305
3344
|
userId: ctx.userId != null ? String(ctx.userId) : void 0,
|
|
3306
|
-
|
|
3307
|
-
|
|
3345
|
+
// Redact secrets before they are persisted (error_events.headers) and
|
|
3346
|
+
// forwarded to Slack (S-H3 / S-M2 / S-L3).
|
|
3347
|
+
headers: redact(ctx.request.headers, SENSITIVE_HEADERS),
|
|
3348
|
+
query: redact(ctx.request.query, SENSITIVE_QUERY),
|
|
3308
3349
|
environment: options.environment
|
|
3309
3350
|
};
|
|
3310
3351
|
const metadata = options.extractMetadata?.(err, trackingCtx);
|