You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/pg-connection-string/README.md
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -88,18 +88,21 @@ Query parameters follow a `?` character, including the following special query p
88
88
*`encoding=<encoding>` - sets the `client_encoding` property
89
89
*`ssl=1`, `ssl=true`, `ssl=0`, `ssl=false` - sets `ssl` to true or false, accordingly
90
90
*`sslcompat=libpq` - use libpq semantics for `sslmode`
91
+
*`sslmode=<sslmode>` when `sslcompat` is not set
92
+
*`sslmode=disable` - sets `ssl` to false
93
+
*`sslmode=no-verify` - sets `ssl` to `{ rejectUnauthorized: false }`
94
+
*`sslmode=prefer`, `sslmode=require`, `sslmode=verify-ca`, `sslmode=verify-full` - sets `ssl` to true
91
95
*`sslmode=<sslmode>` when `sslcompat=libpq`
92
96
*`sslmode=disable` - sets `ssl` to false
93
97
*`sslmode=prefer` - sets `ssl` to `{ rejectUnauthorized: false }`
94
98
*`sslmode=require` - sets `ssl` to `{ rejectUnauthorized: false }` unless `sslrootcert` is specified, in which case it behaves like `verify-ca`
95
99
*`sslmode=verify-ca` - sets `ssl` to `{ checkServerIdentity: no-op }` (verify CA, but not server identity). This verifies the presented certificate against the effective CA, i.e. the one specified in sslrootcert or the system CA if sslrootcert was not specified.
96
100
*`sslmode=verify-full` - sets `ssl` to `{}` (verify CA and server identity)
97
-
*`sslmode=<sslmode>` when `sslcompat` is not set
98
-
*`sslmode=disable` - sets `ssl` to false
99
-
*`sslmode=no-verify` - sets `ssl` to `{ rejectUnauthorized: false }`
100
-
*`sslmode=prefer`, `sslmode=require`, `sslmode=verify-ca`, `sslmode=verify-full` - sets `ssl` to true
101
101
*`sslcert=<filename>` - reads data from the given file and includes the result as `ssl.cert`
102
102
*`sslkey=<filename>` - reads data from the given file and includes the result as `ssl.key`
103
103
*`sslrootcert=<filename>` - reads data from the given file and includes the result as `ssl.ca`
104
104
105
105
A bare relative URL, such as `salesdata`, will indicate a database name while leaving other properties empty.
106
+
107
+
> [!CAUTION]
108
+
> Choosing an sslmode other than verify-full has serious security implications. Please read https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS to understand the trade-offs.
Copy file name to clipboardExpand all lines: packages/pg-connection-string/index.js
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,11 @@ function parse(str) {
107
107
break
108
108
}
109
109
case'verify-ca': {
110
+
if(!config.ssl.ca){
111
+
thrownewError(
112
+
'SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.'
0 commit comments