Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion teaagent/cli/_handlers/_mcp_trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
)


def _strip_sensitive_fields(value: Any) -> Any:
if isinstance(value, dict):
sanitized: dict[str, Any] = {}
for key, item in value.items():
if isinstance(key, str) and key.strip().lower() == 'trusted':
continue
sanitized[key] = _strip_sensitive_fields(item)
return sanitized
if isinstance(value, list):
return [_strip_sensitive_fields(item) for item in value]
return value


def _redact_sensitive(value: Any) -> Any:
def _is_sensitive_key(key: Any) -> bool:
if not isinstance(key, str):
Expand Down Expand Up @@ -45,7 +58,10 @@ def _is_sensitive_key(key: Any) -> bool:
def _print_json(value: Any) -> None:
print(
json.dumps(
_redact_sensitive(value), ensure_ascii=False, indent=2, sort_keys=True
_redact_sensitive(_strip_sensitive_fields(value)),
ensure_ascii=False,
indent=2,
sort_keys=True,
)
)

Expand Down
Loading