Skip to content

Commit 5af779f

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 5af779f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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)