(event: Sentry.ErrorEvent)
| 68 | } |
| 69 | |
| 70 | function redactEvent(event: Sentry.ErrorEvent): Sentry.ErrorEvent { |
| 71 | // Remove default identity/request surfaces entirely. |
| 72 | delete event.user; |
| 73 | delete event.request; |
| 74 | delete event.breadcrumbs; |
| 75 | |
| 76 | if (typeof event.message === 'string') { |
| 77 | event.message = redactPathLikeData(event.message); |
| 78 | } |
| 79 | |
| 80 | const exceptionValues = event.exception?.values ?? []; |
| 81 | for (const exceptionValue of exceptionValues) { |
| 82 | if (typeof exceptionValue.value === 'string') { |
| 83 | exceptionValue.value = redactPathLikeData(exceptionValue.value); |
| 84 | } |
| 85 | |
| 86 | const frames = exceptionValue.stacktrace?.frames ?? []; |
| 87 | for (const frame of frames) { |
| 88 | if (typeof frame.abs_path === 'string') { |
| 89 | frame.abs_path = redactPathLikeData(frame.abs_path); |
| 90 | } |
| 91 | if (typeof frame.filename === 'string') { |
| 92 | frame.filename = redactPathLikeData(frame.filename); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if (event.extra) { |
| 98 | for (const [key, value] of Object.entries(event.extra)) { |
| 99 | event.extra[key] = redactUnknown(value); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | return event; |
| 104 | } |
| 105 | |
| 106 | function redactLog(log: Sentry.Log): Sentry.Log | null { |
| 107 | if (!log) { |
no test coverage detected