Skip to content

Security: Hardcoded default database credentials in production config#221

Open
Nam0101 wants to merge 1 commit intosassanix:mainfrom
Nam0101:contribai/fix/security/hardcoded-default-database-credentials-i
Open

Security: Hardcoded default database credentials in production config#221
Nam0101 wants to merge 1 commit intosassanix:mainfrom
Nam0101:contribai/fix/security/hardcoded-default-database-credentials-i

Conversation

@Nam0101
Copy link
Copy Markdown

@Nam0101 Nam0101 commented Mar 30, 2026

Hi there! 👋

While going through the codebase, I noticed a minor opportunity for improvement regarding backend/config.py.

Context:
The config includes usable default credentials (DB_USER='warranty_user', DB_PASSWORD='warranty_password', DB_ADMIN_USER='warracker_admin', DB_ADMIN_PASSWORD='change_this_password_in_production'). In real deployments, missing env vars will silently activate these predictable credentials, allowing unauthorized DB access if the database is reachable.

Proposed fix:
Remove credential defaults and require environment variables at startup. Example: DB_PASSWORD = os.environ["DB_PASSWORD"] (same for admin creds), and raise a clear startup error if unset. If local development needs defaults, isolate them in a dedicated non-production config class not used in Docker/CI/prod.

Files touched:

  • backend/config.py (modified)

(Note: Tested the changes locally to ensure everything works as expected. Let me know if you need any adjustments, happy to help!)


NamNV
📍 Hanoi, Vietnam
📧 nam.nv205106@gmail.com

…onfig

The config includes usable default credentials (`DB_USER='warranty_user'`, `DB_PASSWORD='warranty_password'`, `DB_ADMIN_USER='warracker_admin'`, `DB_ADMIN_PASSWORD='change_this_password_in_production'`). In real deployments, missing env vars will silently activate these predictable credentials, allowing unauthorized DB access if the database is reachable.


Affected files: config.py

Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant