MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / sanitizeForSlack

Function sanitizeForSlack

server/src/utils/posthog.ts:216–221  ·  view source on GitHub ↗

* Strip connection strings, credentials, and other secrets from error messages * before forwarding to Slack.

(msg: string)

Source from the content-addressed store, hash-verified

214 * before forwarding to Slack.
215 */
216function sanitizeForSlack(msg: string): string {
217 return msg
218 .replace(/\b\w+:\/\/[^\s]+@[^\s]+/g, '[REDACTED_URL]')
219 .replace(/password[=:]\s*\S+/gi, 'password=[REDACTED]')
220 .replace(/\b(sk|pk|api[_-]?key|secret|token)[_-]?\w*[=:]\s*\S+/gi, '$1=[REDACTED]');
221}
222
223/**
224 * Bridge logger.error() to the #aao-errors Slack channel via notifySystemError.

Callers 2

notifyErrorChannelFunction · 0.85
notifySlackCriticalErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected