Back to all reviewers

Sanitize debug output

ghostty-org/ghostty
Based on 1 comments
Python

Never print or log sensitive information such as tokens, passwords, or secrets that might be present in environment variables or configuration. When debugging with environment variables, always sanitize the output by filtering out sensitive keys.

Security Python

Reviewer Prompt

Never print or log sensitive information such as tokens, passwords, or secrets that might be present in environment variables or configuration. When debugging with environment variables, always sanitize the output by filtering out sensitive keys.

Instead of:

print(*os.environ)
# or
print("token_start", repr(os.environ["GITHUB_TOKEN"][:10]))

Use sanitized output:

print("Environment variables (sanitized):")
print({k: v for k, v in os.environ.items() if "TOKEN" not in k and "PASSWORD" not in k and "SECRET" not in k})

This prevents accidental exposure of credentials in logs, console output, or error reports that could lead to security breaches if captured by unauthorized parties.

1
Comments Analyzed
Python
Primary Language
Security
Category

Source Discussions