File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
packages/pg-connection-string Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ function parse(str) {
108108 break
109109 }
110110 case 'verify-ca' : {
111+ if ( ! config . ssl . ca ) {
112+ throw new Error ( 'sslmode=verify-ca requires specifying a CA with sslrootcert' )
113+ }
111114 config . ssl . checkServerIdentity = function ( ) { }
112115 break
113116 }
Original file line number Diff line number Diff line change @@ -297,6 +297,13 @@ describe('parse', function () {
297297
298298 it ( 'configuration parameter sslmode=verify-ca with libpq compatibility' , function ( ) {
299299 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'
300307 var subject = parse ( connectionString )
301308 subject . ssl . should . have . property ( 'checkServerIdentity' ) . that . is . a ( 'function' )
302309 expect ( subject . ssl . checkServerIdentity ( ) ) . be . undefined
You can’t perform that action at this time.
0 commit comments