Skip to content

Commit a63cae3

Browse files
committed
feat(pg-connection-string): warn if non-standard ssl options are used
In preparation for v3.0.0, we start warning users to be explicit about the sslmode they want.
1 parent 9cf2184 commit a63cae3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"processes":{"417f2d4c-eaf2-4112-952c-a801df7fb93d":{"parent":null,"children":[]}},"files":{"/Users/bmc/src/node-postgres/packages/pg-connection-string/index.js":["417f2d4c-eaf2-4112-952c-a801df7fb93d"]},"externalIds":{}}
1+
{"processes":{"1bddb29d-b157-468d-a89e-00f3a50ed517":{"parent":null,"children":[]}},"files":{"/Users/herman/Code/node-postgres/packages/pg-connection-string/index.js":["1bddb29d-b157-468d-a89e-00f3a50ed517"]},"externalIds":{}}

packages/pg-connection-string/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ function parse(str, options = {}) {
133133
case 'require':
134134
case 'verify-ca':
135135
case 'verify-full': {
136+
if (config.sslmode !== 'verify-full') {
137+
console.warn(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
138+
In the next major version (v3.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
139+
140+
To prepare for this change:
141+
- If you want the current behavior, explicitly use 'sslmode=verify-full'
142+
- If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=${config.sslmode}'
143+
144+
See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`)
145+
}
136146
break
137147
}
138148
case 'no-verify': {

0 commit comments

Comments
 (0)