Skip to content

fix: Enable TLS certificate validation in production#838

Merged
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
MooreTheAnalyst:fix/709-postgresql-tls-certificate-validation
Jul 2, 2026
Merged

fix: Enable TLS certificate validation in production#838
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
MooreTheAnalyst:fix/709-postgresql-tls-certificate-validation

Conversation

@MooreTheAnalyst

Copy link
Copy Markdown
Contributor

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

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great job so far

There’s just one blocker — merge conflict. Could you take a look and resolve it?

Happy to review again once that’s done.

@MooreTheAnalyst

Copy link
Copy Markdown
Contributor Author

Yes. Sure. Will take a look and resolve it now.
Thanks

@MooreTheAnalyst

MooreTheAnalyst commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

I have resolved it. Should be ready to merge :)

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit da40816 into rinafcode:main Jul 2, 2026
6 checks passed
@MooreTheAnalyst

Copy link
Copy Markdown
Contributor Author

It is a pleasure to :)

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

2 participants