question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no way to set rejectUnauthorized from pg-connection-string

See original GitHub issue

Now that rejectUnauthorized is being defaulted to true, there is no way to modify that from the connection string. Some libraries (example are setting opposite defaults to try and ease the migration.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
ollytheninjacommented, Jan 18, 2022

Hi everyone, I have a requirement to use verify-ca - with the AWS RDS proxy service the hostname is invalid and you can only check the CA. The OS already has the relevant AWS CA installed.

I’m not clear on whether doing the above (set rejectUnauthorized: false) will actually check the CA? Is there an equivalent to the native verify-ca option or do I need to specify the CA certificate to make it check just the CA?

👍 for having an sslmode argument but want to make sure it’ll actually match psql configuration exactly

2reactions
hjr3commented, Jul 16, 2020

My recommendation:

In general, we should adhere to the libpq connection URI documentation. Specifically, we should support the Parameter Key Words.

  • introduce sslmode. For non-native mode, I do not think we can easily support allow or prefer. I also think verify-ca will not work as expected as rejectUnauthorized seems to check the host. We can document the mapping for non-native mode like this:
sslmode Will connection via SSL/TLS? rejectUnauthorized
disable no n/a
allow no n/a
prefer no n/a
require yes false
verify-ca yes false
verify-full yes true

I do not feel great about verify-ca not setting rejectUnauthorized = true. https://github.com/brianc/node-postgres-docs/issues/79 shows that rejectUnauthorized often requires the host to be specified. This is more strict than the true meaning of verify-ca. That being said, I wonder if we should make it rejectUnauthorized = true even though the postgres documentation states that verify-ca will not check the host.

  • deprecate ssl. If both ssl and sslmode are specified, sslmode will win
  • if ssl is set, also set rejectUnauthorized: true. This maintains the node default but makes it more obvious as to what is going on
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Is it ok to be setting rejectUnauthorized to false in ...
We recently moved to Heroku and upon attempting to connect our apps to the DB, it kept rejecting our queries with the message...
Read more >
pg-connection-string - npm
When user and password are given, they are included in the typical URL positions, with an empty host , as in socket://user:pass@/var/run/pgsql ....
Read more >
tls - Is it safe to set rejectUnauthorized to false when using ...
My question is how safe is this with a Postgres database on Heroku and would it pose any threat to the security of...
Read more >
Why am I getting an error when I upgrade to pg@8?
Resolution. Depending on the setup, the pg config will need to set the rejectUnauthorized value to false . This can be done 1...
Read more >
node tls rejectunauthorized=0 - You.com | The AI Search ...
BlockI don't want to see this, for any search. Feedback. What do you think of this? How to set value for NODE_TLS_REJECT_UNAUTHORIZED =0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found