Skip to content

fix: Enable TLS certificate validation in production#838

Open
MooreTheAnalyst wants to merge 1 commit into
rinafcode:mainfrom
MooreTheAnalyst:fix/709-postgresql-tls-certificate-validation
Open

fix: Enable TLS certificate validation in production#838
MooreTheAnalyst wants to merge 1 commit into
rinafcode:mainfrom
MooreTheAnalyst:fix/709-postgresql-tls-certificate-validation

Conversation

@MooreTheAnalyst

Copy link
Copy Markdown

Fixed the PostgreSQL TLS certificate validation vulnerability (#709):

  1. src/lib/db/pool.ts - Set rejectUnauthorized: true in production, added DB_SSL_CA environment variable for CA certificate path, and added startup validation to ensure it's provided in production.

  2. .env.example - Documented the new DB_SSL_CA variable with usage examples.

  3. Branch & Commit - Created fix/709-postgresql-tls-certificate-validation branch, committed changes with clear message, and pushed to origin. No type errors detected. Ready for PR.

Closes #709

- Set rejectUnauthorized: true in production SSL config
- Add DB_SSL_CA environment variable for CA certificate path
- Validate DB_SSL_CA is provided on module load in production
- Development continues to allow unverified certificates
- Document required environment variables in .env.example

Fixes: Prevents man-in-the-middle attacks by enforcing TLS certificate
verification in production database connections.
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@MooreTheAnalyst Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Bug] PostgreSQL pool uses rejectUnauthorized: false in production — accepts any TLS certificate

1 participant