This is an automated email from the ASF dual-hosted git repository.

CritasWang pushed a commit to branch redact-password-in-config-log
in repository https://gitbox.apache.org/repos/asf/iotdb-mcp-server.git

commit 3ff1cbd58e8a1fb2fded0c8be08b9338cbf7cc8e
Author: CritasWang <[email protected]>
AuthorDate: Mon Sep 7 16:42:40 2026 +0800

    Mask password in startup config log output
    
    The startup log printed the full IoTDB config dict including the password 
field. Log a copy of the config with the password masked instead, and exclude 
the password from the Config repr.
---
 src/iotdb_mcp_server/config.py | 4 ++--
 src/iotdb_mcp_server/server.py | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/iotdb_mcp_server/config.py b/src/iotdb_mcp_server/config.py
index a646891..7e4ad78 100644
--- a/src/iotdb_mcp_server/config.py
+++ b/src/iotdb_mcp_server/config.py
@@ -17,7 +17,7 @@
 #
 
 import argparse
-from dataclasses import dataclass
+from dataclasses import dataclass, field
 import os
 
 
@@ -42,7 +42,7 @@ class Config:
     IoTDB username
     """
 
-    password: str
+    password: str = field(repr=False)
     """
     IoTDB password
     """
diff --git a/src/iotdb_mcp_server/server.py b/src/iotdb_mcp_server/server.py
index 997a760..489687e 100644
--- a/src/iotdb_mcp_server/server.py
+++ b/src/iotdb_mcp_server/server.py
@@ -63,7 +63,9 @@ db_config = {
 
 max_pool_size = 100  # Increased from 100 for better concurrency
 
-logger.info(f"IoTDB Config: {db_config}")
+# Never print credentials: log a copy of the config with the password masked.
+logged_config = {**db_config, "password": "***"}
+logger.info(f"IoTDB Config: {logged_config}")
 
 # Ensure export directory exists
 if not os.path.exists(config.export_path):

Reply via email to