Skip to content

fix(security): replace hardcoded DB_PASSWORD with env var in dev docker-compose configs (#43)#144

Merged
YaronZaki merged 3 commits into
Quantarq:mainfrom
NteinPrecious:feature/issue-43-replace-hardcoded-db-password
Jun 19, 2026
Merged

fix(security): replace hardcoded DB_PASSWORD with env var in dev docker-compose configs (#43)#144
YaronZaki merged 3 commits into
Quantarq:mainfrom
NteinPrecious:feature/issue-43-replace-hardcoded-db-password

Conversation

@NteinPrecious

Copy link
Copy Markdown
Contributor

Summary

Resolves #43 — three docker-compose development files hardcoded DB_PASSWORD=password and POSTGRES_PASSWORD=password as literal strings. If a developer copied this pattern to production the database would have a known, guessable password. Inconsistency with the production config (which correctly uses ${DB_PASSWORD}) also creates confusion.

Changes

Replaced hardcoded password with ${DB_PASSWORD:-password} in:

File Before After
devops/docker-compose.quantara.dev.yaml DB_PASSWORD=password DB_PASSWORD=${DB_PASSWORD:-password}
devops/docker-compose.quantara.dev.yaml POSTGRES_PASSWORD: password POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
devops/docker-compose.quantara.back.yaml same same
devops/docker-compose.quantara.dev-windows.yaml same same

The :-password fallback means:

  • No env var set → uses password as before (zero friction for existing devs)
  • DB_PASSWORD set in host environment → uses that value (enables teams to set stronger passwords)

The quantara/.env.dev file already contains DB_PASSWORD=password and was not changed.

The CI workflow files (.github/workflows/ci.yml, integration-tests.yml) were intentionally left unchanged — they already set DB_PASSWORD: password explicitly as environment variables for the test runner.

Test plan

  • docker compose -f devops/docker-compose.quantara.dev.yaml up -d still works without any extra config (fallback password applies)
  • Setting DB_PASSWORD=testpass in host env before compose-up correctly propagates to the container
  • CI passes — compose files are not executed by CI; only pytest and alembic run

Closes #43

🤖 Generated with Claude Code

…ral in devops/docker-compose.quantara.dev.yaml
…ral in devops/docker-compose.quantara.back.yaml
…ral in devops/docker-compose.quantara.dev-windows.yaml

@YaronZaki YaronZaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YaronZaki YaronZaki merged commit e5efd24 into Quantarq:main Jun 19, 2026
3 checks passed
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.

security: Replace hardcoded DB_PASSWORD in docker-compose development configs

2 participants