The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(mcp): error sanitizer redacts dotted/dashed sk- keys
teknium1dd07510226a1
diff --git a/tests/tools/test_mcp_tool.py b/tests/tools/test_mcp_tool.pyindex 42d079a1ce1..469ad51a7dc 100644--- a/tests/tools/test_mcp_tool.py+++ b/tests/tools/test_mcp_tool.py@@ -1569,6 +1569,8 @@ class TestSanitizeError:for text, expected in (("Error with ghp_abc123def456", "Error with [REDACTED]"),("key sk-projABC123xyz", "key [REDACTED]"),+ # Dotted/dashed provider keys (``sk-sp-…``/``sk-ws-…``) must not leak a tail.+ ("key sk-sp-ABCDEFGH12345678.abcdefgh_XYZ-0987.", "key [REDACTED]."),("Authorization: Bearer eyJabc123def", "Authorization: [REDACTED]"),("url?token=secret123", "url?[REDACTED]"),):diff --git a/tools/mcp_tool_common.py b/tools/mcp_tool_common.pyindex 37f57d707cc..6ad04d7b214 100644--- a/tools/mcp_tool_common.py+++ b/tools/mcp_tool_common.py@@ -70,7 +70,7 @@ def _jittered(seconds: float) -> float:# Credential patterns to strip from error messages: GitHub PAT, OpenAI-style key, Bearer token,# and ``token= / key= / API_KEY= / password= / secret=`` assignments._CREDENTIAL_PATTERN = re.compile(- r"(?:ghp_[A-Za-z0-9_]{1,255}|sk-[A-Za-z0-9_]{1,255}|Bearer\s+\S+"+ r"(?:ghp_[A-Za-z0-9_]{1,255}|sk-[A-Za-z0-9_-](?:\.?[A-Za-z0-9_-]){0,254}|Bearer\s+\S+"r"|(?:token|key|API_KEY|password|secret)=[^\s&,;\"']{1,255})", re.IGNORECASE)