From 591264109e7a238546be21a708ce01565dcda5a8 Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Mon, 13 Jan 2020 08:33:40 -0800 Subject: [PATCH] Allow password option to be non-enumerable to avoid breaking uses like `new Pool(existingPool.options)`. --- packages/pg-pool/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/pg-pool/index.js b/packages/pg-pool/index.js index 64dc5fa91..79a3eca32 100644 --- a/packages/pg-pool/index.js +++ b/packages/pg-pool/index.js @@ -61,14 +61,13 @@ class Pool extends EventEmitter { super() this.options = Object.assign({}, options) - if ('password' in this.options) { - const password = this.options.password + if (options != null && 'password' in options) { // "hiding" the password so it doesn't show up in stack traces // or if the client is console.logged Object.defineProperty(this.options, 'password', { configurable: true, enumerable: false, - value: password, + value: options.password, writable: true }) }