File tree 2 files changed +10
-0
lines changed
packages/pg-connection-string
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ function parse(str) {
108
108
break
109
109
}
110
110
case 'verify-ca' : {
111
+ if ( ! config . ssl . ca ) {
112
+ throw new Error ( 'sslmode=verify-ca requires specifying a CA with sslrootcert' )
113
+ }
111
114
config . ssl . checkServerIdentity = function ( ) { }
112
115
break
113
116
}
Original file line number Diff line number Diff line change @@ -297,6 +297,13 @@ describe('parse', function () {
297
297
298
298
it ( 'configuration parameter sslmode=verify-ca with libpq compatibility' , function ( ) {
299
299
var connectionString = 'pg:///?sslmode=verify-ca&sslcompat=libpq'
300
+ expect ( function ( ) {
301
+ parse ( connectionString )
302
+ } ) . to . throw ( )
303
+ } )
304
+
305
+ it ( 'configuration parameter sslmode=verify-ca and sslrootcert owith libpq compatibility' , function ( ) {
306
+ var connectionString = 'pg:///?sslmode=verify-ca&sslcompat=libpq&sslrootcert=' + __dirname + '/example.ca'
300
307
var subject = parse ( connectionString )
301
308
subject . ssl . should . have . property ( 'checkServerIdentity' ) . that . is . a ( 'function' )
302
309
expect ( subject . ssl . checkServerIdentity ( ) ) . be . undefined
You can’t perform that action at this time.
0 commit comments