Skip to content

fix(security): redact clear-text logging of sensitive information#80

Closed
scottschreckengaust wants to merge 1 commit into
mainfrom
alert-autofix-24
Closed

fix(security): redact clear-text logging of sensitive information#80
scottschreckengaust wants to merge 1 commit into
mainfrom
alert-autofix-24

Conversation

@scottschreckengaust
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/security/code-scanning/24

Best fix: harden _debug_cw so it never logs raw free-form text; instead, apply stronger sanitization that masks known secret values and secret-like key/value patterns before printing or shipping to CloudWatch.

Concretely in agent/src/server.py:

  • Add import re.
  • Replace _redact_cached_credentials implementation with a stronger sanitizer that:
    1. Redacts cached env secret values (GITHUB_TOKEN, LINEAR_API_TOKEN) when present.
    2. Redacts common secret assignment patterns in text (e.g., github_token=..., authorization: Bearer ..., secret=..., token=..., api_key=..., password=...) using regex.
  • Keep behavior unchanged otherwise (same function name and call sites), so logging still works but sensitive values are masked.

No functional flow changes are required; only log content sanitization is strengthened.

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

Potential fix for code scanning alert: "Clear-text logging of sensitive information"

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@scottschreckengaust scottschreckengaust changed the title Potential fix for code scanning alert no. 24: Clear-text logging of sensitive information fix(security): redact clear-text logging of sensitive information May 13, 2026
@krokoko
Copy link
Copy Markdown
Contributor

krokoko commented May 13, 2026

Closing since fixed in #81

@krokoko krokoko closed this May 13, 2026
@scottschreckengaust scottschreckengaust deleted the alert-autofix-24 branch May 13, 2026 20:11
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.

2 participants