Skip to content

Fix 'Error: invalid sslmode value: "true"' in native mode - #2299

Open
sundbry wants to merge 3 commits into
brianc:masterfrom
chronicled:fix-native-sslmode
Open

sundbry wants to merge 3 commits into
brianc:masterfrom
chronicled:fix-native-sslmode

Conversation

@sundbry

@sundbry sundbry commented Jul 31, 2020

Copy link
Copy Markdown

When using PGSSLMODE env in native mode, an invalid database URL string
is constructed with sslmode=true/false.

Ryan Sundberg added 3 commits July 31, 2020 15:37
When using PGSSLMODE env in native mode, an invalid database URL string
would be constructed with sslmode=true/false.
@brianc

brianc commented Aug 3, 2020

Copy link
Copy Markdown
Owner

Hey thanks for this! Is there a way to write a test for this? If not, if you could show an example in code that causes the problem I can write a test to exercise the fix. Either way I'm good - but need to get this under test so we don't regress on it! 😄

@Andrei-Stepanov

Copy link
Copy Markdown

Hello, please merge and release this.
This is important.
It is necessary to have this merged.

[Error: invalid sslmode value: "true"
]

@sundbry thank you for the fix!

@Andrei-Stepanov

Copy link
Copy Markdown

This bug is present in "pg": "^8.7.1",

@charmander

Copy link
Copy Markdown
Collaborator

@Andrei-Stepanov There’s still no test. What configuration causes this error?

@Andrei-Stepanov

Copy link
Copy Markdown

@charmander : configuration/testcase scenario:

  1. Have a postgresql-server without SSL transport.
  2. Try to connect to this server using pg module enforcing/requiring SSL transport with env variable:
    PGSSLMODE=require.

Connection should not be established, but it is estalished. pg overrides this parameter.

Related docs:
https://www.postgresql.org/docs/current/libpq-envars.html
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLMODE

@charmander

Copy link
Copy Markdown
Collaborator

@Andrei-Stepanov Which is it? Connection is established when it should not be, or Error: invalid sslmode value: "true"?

@Andrei-Stepanov

Copy link
Copy Markdown

I think this: Connection is established when it should not be.

@charmander

Copy link
Copy Markdown
Collaborator

@Andrei-Stepanov That sounds like an issue separate from what this PR claims to address (and what I was requesting a test case for), then. Please open an issue for it.

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.

4 participants