1 The Danger of Hardcoded Credentials
Hardcoded secrets — API keys, database passwords, JWT signing keys — embedded in source code are one of the most common and impactful security mistakes. Once code is committed to a repository, the secret is compromised — even if it is removed in a later commit, git history preserves it forever.
# CRITICAL — never do this
DB_PASSWORD = "SuperSecret!2024"
API_KEY = "sk-live-abc123xyz789"
def connect():
return psycopg2.connect(password=DB_PASSWORD)
Public GitHub repositories are continuously scraped by automated tools looking for secrets. Private repositories are also at risk from insider threats, stolen tokens, or accidental exposure.