Skip to content

datarobot_genai.drmcputils.log_redaction

log_redaction

Shared secret-redaction patterns for MCP server logs.

The user-MCP logging formatter (drmcp.core.logging) and global-mcp's logging filter apply the same redaction, so the canonical pattern list and helper live here and both import them.

redact_secrets

redact_secrets(text: str) -> str

Replace every secret-shaped substring in text with [REDACTED].

Source code in datarobot_genai/drmcputils/log_redaction.py
def redact_secrets(text: str) -> str:
    """Replace every secret-shaped substring in ``text`` with ``[REDACTED]``."""
    for pattern in _COMPILED_SECRET_PATTERNS:
        text = pattern.sub(REDACTED, text)
    return text