MCPcopy Create free account
hub / github.com/codeaashu/claude-code / redactSecrets

Function redactSecrets

src/services/teamMemorySync/secretScanner.ts:312–324  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

310let redactRules: RegExp[] | null = null
311
312export function redactSecrets(content: string): string {
313 redactRules ??= SECRET_RULES.map(
314 r => new RegExp(r.source, (r.flags ?? '').replace('g', '') + 'g'),
315 )
316 for (const re of redactRules) {
317 // Replace only the captured group, not the full match — patterns include
318 // boundary chars (space, quote, ;) outside the group that must survive.
319 content = content.replace(re, (match, g1) =>
320 typeof g1 === 'string' ? match.replace(g1, '[REDACTED]') : '[REDACTED]',
321 )
322 }
323 return content
324}
325

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected