MCPcopy Create free account
hub / github.com/agent-tower/core / redactSensitiveText

Function redactSensitiveText

packages/server/src/utils/error-log.ts:136–146  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

134}
135
136function 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
148function redactQuotedAuthorizationHeaders(value: string): string {
149 return value

Callers 2

formatErrorLogEntryFunction · 0.85
sanitizeValueFunction · 0.85

Calls 2

redactSensitiveHeadersFunction · 0.85

Tested by

no test coverage detected