Hardcoded Database Connection String

Detects database connection strings with embedded credentials hardcoded in source code.

zakirkun 27e65b8 2 files · 3.0 KB Updated

File contents

Hardcoded Database Connection String

Overview

Database connection strings containing credentials embedded directly in source code are exposed whenever the code is shared, committed to version control, or viewed by anyone with code access. This is one of the most common causes of database credential leaks.

Remediation

  • Use environment variables for all credential components
  • Use a secrets manager (AWS Secrets Manager, Vault, Azure Key Vault)
  • Never commit .env files with real credentials

Safe:

conn_str = os.environ["DATABASE_URL"]

zakirkun/ice-tea/tree/main/skills/database/db-connection-string commit 27e65b8387

Frequently asked questions

npx skillmds@latest add zakirkun/hardcoded-database-connection-string