File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,14 @@ class Pool extends EventEmitter {
7373 value : options . password ,
7474 } )
7575 }
76+ if ( options != null && options . ssl && options . ssl . key ) {
77+ // "hiding" the ssl->key so it doesn't show up in stack traces
78+ // or if the client is console.logged
79+ this . options . ssl . key = options . ssl . key
80+ Object . defineProperty ( this . options . ssl , 'key' , {
81+ enumerable : false ,
82+ } )
83+ }
7684
7785 this . options . max = this . options . max || this . options . poolSize || 10
7886 this . options . maxUses = this . options . maxUses || Infinity
Original file line number Diff line number Diff line change @@ -57,6 +57,15 @@ class Client extends EventEmitter {
5757 this . processID = null
5858 this . secretKey = null
5959 this . ssl = this . connectionParameters . ssl || false
60+ // As with Password, make SSL->Key (the private key) non-enumerable.
61+ // It won't show up in stack traces
62+ // or if the client is console.logged
63+ if ( this . ssl && this . ssl . key ) {
64+ Object . defineProperty ( this . ssl , 'key' , {
65+ enumerable : false ,
66+ } )
67+ }
68+
6069 this . _connectionTimeoutMillis = c . connectionTimeoutMillis || 0
6170 }
6271
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ class ConnectionParameters {
8484 if ( this . ssl === 'no-verify' ) {
8585 this . ssl = { rejectUnauthorized : false }
8686 }
87+ if ( this . ssl && this . ssl . key ) {
88+ Object . defineProperty ( this . ssl , 'key' , {
89+ enumerable : false ,
90+ } )
91+ }
8792
8893 this . client_encoding = val ( 'client_encoding' , config )
8994 this . replication = val ( 'replication' , config )
You can’t perform that action at this time.
0 commit comments