(value: string)
| 134 | } |
| 135 | |
| 136 | function redactSensitiveText(value: string): string { |
| 137 | const redactedQuotedAuthorization = redactQuotedAuthorizationHeaders(value); |
| 138 | const truncated = redactedQuotedAuthorization.length > MAX_STRING_LENGTH |
| 139 | ? `${redactedQuotedAuthorization.slice(0, MAX_STRING_LENGTH)}...[truncated]` |
| 140 | : redactedQuotedAuthorization; |
| 141 | |
| 142 | return redactSensitiveHeaders(truncated |
| 143 | .replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, 'Bearer [REDACTED]') |
| 144 | .replace(SENSITIVE_ASSIGNMENT_PATTERN, '$1$2$3[REDACTED]') |
| 145 | .replace(/\bsk-[A-Za-z0-9_-]{12,}/g, 'sk-[REDACTED]')); |
| 146 | } |
| 147 | |
| 148 | function redactQuotedAuthorizationHeaders(value: string): string { |
| 149 | return value |
no test coverage detected