File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/pg-connection-string Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
+ const { emitWarning } = require ( 'node:process' )
4
+
3
5
//Parse method copied from https://github.com/brianc/node-postgres
4
6
//Copyright (c) 2010-2014 Brian Carlson ([email protected] )
5
7
//MIT License
@@ -133,6 +135,9 @@ function parse(str, options = {}) {
133
135
case 'require' :
134
136
case 'verify-ca' :
135
137
case 'verify-full' : {
138
+ if ( config . sslmode !== 'verify-full' ) {
139
+ deprecatedSslModeWarning ( config . sslmode )
140
+ }
136
141
break
137
142
}
138
143
case 'no-verify' : {
@@ -201,6 +206,20 @@ function parseIntoClientConfig(str) {
201
206
return toClientConfig ( parse ( str ) )
202
207
}
203
208
209
+ function deprecatedSslModeWarning ( sslmode ) {
210
+ if ( ! deprecatedSslModeWarning . warned ) {
211
+ deprecatedSslModeWarning . warned = true
212
+ emitWarning ( `SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
213
+ In the next major version (v3.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
214
+
215
+ To prepare for this change:
216
+ - If you want the current behavior, explicitly use 'sslmode=verify-full'
217
+ - If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=${ sslmode } '
218
+
219
+ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.` )
220
+ }
221
+ }
222
+
204
223
module . exports = parse
205
224
206
225
parse . parse = parse
You can’t perform that action at this time.
0 commit comments