Skip to content

Remove hardcoded database credentials from db_utils.py #94

@dprodger

Description

@dprodger

Summary

backend/db_utils.py has database credentials (host, user, password, port) hardcoded as default values in the DB_CONFIG dict. These should be read exclusively from environment variables, with no fallback defaults.

What to do

  1. Rotate the DB password in Supabase — the current password has been stored in cleartext in the repo history for months. Even after removing it from code, it remains in git history. Change it in Supabase first, then update:

    • Your local .env
    • GitHub Actions secrets (DB_PASSWORD)
    • Any production environment variables (Render, etc.)
  2. Remove the hardcoded defaults from db_utils.py:

    # Before (insecure)
    DB_CONFIG = {
        'host': os.environ.get('DB_HOST', 'aws-1-us-east-2.pooler.supabase.com'),
        'password': os.environ.get('DB_PASSWORD', 'jovpeW-pukgu0-nifron'),
        ...
    }
    
    # After (secure)
    DB_CONFIG = {
        'host': os.environ['DB_HOST'],
        'password': os.environ['DB_PASSWORD'],
        ...
    }
  3. Verify that all environments (local dev, GitHub Actions, production) have the variables set before deploying.

Why

Hardcoded credentials in source code are a security risk. Even in a private repo, credentials in git history are effectively permanent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions