Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PGSSLMODE=no-verify support to opt-out of rejecting self-signed certs #2195

Merged
merged 1 commit into from
May 7, 2020

Conversation

bensalilijames
Copy link
Contributor

@bensalilijames bensalilijames commented May 5, 2020

Upgrading to pg@8 is currently quite hard if relying on environment variables to set the SSL mode. For example, on Heroku, SSL is required, but the certs are not available. A good way to set this up traditionally is to set PGSSLMODE=require for app dynos, and PGSSLMODE=false (or not defined) for in-dyno CI (local ephemeral test databases).

However, in pg@8 the { rejectUnauthorized: false } option needs to be used, so this means consumers need to update all code to be aware of the environment it's running in. This also extends to code from third parties (e.g. migration frameworks like db-migrate), which would need to internally set this option to continue working. All of this means it's quite hard to upgrade.

A simple solution is to to support implementing a PGSSLMODE=no-verify option as suggested in this comment: #2009 (comment). This PR does exactly that! 👍

@bensalilijames bensalilijames changed the title Add PGSSLMODE=noverify support to opt-out of rejecting self-signed certs Add PGSSLMODE=no-verify support to opt-out of rejecting self-signed certs May 5, 2020
@brianc
Copy link
Owner

brianc commented May 5, 2020

Thanks for adding this @benjames! I agree we need this. I'm going to need to write some tests for this before I merge it, but I'll do that & get it integrated within the next few days here!

@bensalilijames
Copy link
Contributor Author

Thanks @brianc - much appreciated!

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.

2 participants