Skip to content

Commit 86a8b62

Browse files
Potential fix for code scanning alert no. 30: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent a66f248 commit 86a8b62

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

teaagent/cli/_handlers/_mcp_trust.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ def _is_sensitive_key(key: Any) -> bool:
5656

5757

5858
def _print_json(value: Any) -> None:
59+
def _mask_leaf_values(obj: Any) -> Any:
60+
if isinstance(obj, dict):
61+
return {key: _mask_leaf_values(item) for key, item in obj.items()}
62+
if isinstance(obj, list):
63+
return [_mask_leaf_values(item) for item in obj]
64+
return '[REDACTED]'
65+
5966
print(
6067
json.dumps(
61-
_redact_sensitive(_strip_sensitive_fields(value)),
68+
_mask_leaf_values(_redact_sensitive(_strip_sensitive_fields(value))),
6269
ensure_ascii=False,
6370
indent=2,
6471
sort_keys=True,

0 commit comments

Comments
 (0)