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.
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.
Enter the URL of a public GitHub repository