Skip to content

Potential fix for code scanning alert no. 24: Clear-text logging of sensitive information#42

Merged
johnteee merged 1 commit into
mainfrom
alert-autofix-24
Jun 1, 2026
Merged

Potential fix for code scanning alert no. 24: Clear-text logging of sensitive information#42
johnteee merged 1 commit into
mainfrom
alert-autofix-24

Conversation

@johnteee
Copy link
Copy Markdown
Member

@johnteee johnteee commented Jun 1, 2026

Potential fix for https://github.com/TeaEntityLab/teaAgent/security/code-scanning/24

The best fix is to stop including sensitive trusted fields in CLI output payloads before they are passed to json.dumps. This preserves command behavior (showing policy/tool data) while removing the sensitive attribute from displayed output. This is more robust than only relying on runtime redaction heuristics.

Implement in teaagent/cli/_handlers/_mcp_trust.py:

  • Add a sanitizer helper that removes trusted keys recursively from dict/list payloads.
  • Apply this sanitizer in _print_json before redaction/serialization.
  • Keep _redact_sensitive as defense-in-depth.

This addresses both alert variants because both taint sources (entry.trusted in CLI and server.trusted in to_dict) eventually flow to the same CLI sink; removing trusted at the CLI boundary breaks those flows.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@johnteee johnteee marked this pull request as ready for review June 1, 2026 09:35
@johnteee johnteee merged commit e8ddc29 into main Jun 1, 2026
20 checks passed
@johnteee johnteee deleted the alert-autofix-24 branch June 1, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant