File tree 3 files changed +22
-0
lines changed
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 {
73
73
value : options . password ,
74
74
} )
75
75
}
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
+ }
76
84
77
85
this . options . max = this . options . max || this . options . poolSize || 10
78
86
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 {
57
57
this . processID = null
58
58
this . secretKey = null
59
59
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
+
60
69
this . _connectionTimeoutMillis = c . connectionTimeoutMillis || 0
61
70
}
62
71
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ class ConnectionParameters {
84
84
if ( this . ssl === 'no-verify' ) {
85
85
this . ssl = { rejectUnauthorized : false }
86
86
}
87
+ if ( this . ssl && this . ssl . key ) {
88
+ Object . defineProperty ( this . ssl , 'key' , {
89
+ enumerable : false ,
90
+ } )
91
+ }
87
92
88
93
this . client_encoding = val ( 'client_encoding' , config )
89
94
this . replication = val ( 'replication' , config )
You can’t perform that action at this time.
0 commit comments