Skip to content

Reject insecure database SSL modes in production#5

Merged
pscheid92 merged 1 commit intomainfrom
enforce-production-db-ssl
Feb 22, 2026
Merged

Reject insecure database SSL modes in production#5
pscheid92 merged 1 commit intomainfrom
enforce-production-db-ssl

Conversation

@pscheid92
Copy link
Owner

Summary

  • Reject sslmode=disable and sslmode=allow in DATABASE_URL when APP_ENV=production — startup fails with a clear error message
  • Log the active SSL mode during database connection for operator observability
  • Add production warning comment to .env.example

Development, Docker Compose, and CI are unaffected (they use APP_ENV=development).

Test plan

  • Unit tests for rejected modes (disable, allow, case-insensitive)
  • Unit tests for accepted modes (require, verify-ca, verify-full, prefer, absent)
  • Unit test confirming development mode allows sslmode=disable
  • make test-short passes
  • make lint passes

🤖 Generated with Claude Code

Prevent accidental plaintext database connections when APP_ENV=production
by rejecting sslmode=disable and sslmode=allow at startup. Also log the
active SSL mode during database connection for observability.
@pscheid92 pscheid92 merged commit 06fbdc7 into main Feb 22, 2026
1 check passed
@pscheid92 pscheid92 deleted the enforce-production-db-ssl branch February 22, 2026 21:40
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