Skip to content

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

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

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

Conversation

@johnteee
Copy link
Copy Markdown
Member

@johnteee johnteee commented Jun 4, 2026

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

General fix: make the final logging sink perform a deterministic allow/deny redaction pass that masks values for sensitive keys (including API-token/check structures) before serialization, so no upstream taint can survive to json.dumps.

Best single fix in teaagent/cli/_handlers/_doctor.py:

  1. Strengthen _ensure_log_safe so it also treats likely sensitive environment variable names as sensitive keys (using _looks_like_sensitive_env_name) and recursively masks nested values under those keys.
  2. Ensure print_json always applies this strengthened sink sanitizer immediately before json.dumps (already done; keep as final pass).
  3. No functional behavior change besides safer output redaction.

This addresses all variants at the same sink (json.dumps) by ensuring fields derived from checks['api_token'], PROVIDER_CONFIGS[provider].api_key_env, and config.api_key_env cannot be emitted in clear text.

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 4, 2026 00:59
@johnteee johnteee merged commit a66f248 into main Jun 4, 2026
15 checks passed
@johnteee johnteee deleted the alert-autofix-31 branch June 4, 2026 00:59
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