Never log or store sensitive information (passwords, tokens, secrets) in clear text. This common security vulnerability can lead to credential leaks and unauthorized access.
When logging:
For example, instead of:
logging.info(f"cloning {git_url} to {clone_dir}") # git_url may contain credentials
Use:
# Extract and mask sensitive parts
safe_url = git_url if '@' not in git_url else git_url.split('@')[1]
logging.info(f"cloning {safe_url} to {clone_dir}")
When handling secrets:
Remember that exposing sensitive data in logs is a common finding in security audits and can lead to significant security breaches. Consistently audit your code for instances of clear-text logging or storage of sensitive information.
Enter the URL of a public GitHub repository