Skip to content

Commit d1134f8

Browse files
committed
fix: sanitize wallet object from logs
TICKET: WP-7489
1 parent 5a9e851 commit d1134f8

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,15 @@ export class Wallet implements IWallet {
24072407
'transaction params:',
24082408
_.omit(params, ['keychain', 'prv', 'passphrase', 'walletPassphrase', 'key', 'wallet'])
24092409
);
2410-
console.error('transaction prebuild:', txPrebuild);
2410+
// Sanitize to remove _token from bitgo and omit bitgo from baseCoin/tssUtils
2411+
const sanitizedPrebuild = {
2412+
..._.omit(txPrebuild, ['wallet']),
2413+
wallet: {
2414+
...this,
2415+
bitgo: _.omit(this.bitgo, ['_token']),
2416+
},
2417+
};
2418+
console.error('transaction prebuild:', sanitizedPrebuild);
24112419
console.trace(e);
24122420
throw e;
24132421
}
@@ -2449,7 +2457,13 @@ export class Wallet implements IWallet {
24492457
confirmedBalance: this.confirmedBalance(),
24502458
spendableBalance: this.spendableBalance(),
24512459
};
2452-
error.txParams = _.omit(params, ['keychain', 'prv', 'passphrase', 'walletPassphrase', 'key']);
2460+
error.txParams = {
2461+
..._.omit(params, ['keychain', 'prv', 'passphrase', 'walletPassphrase', 'key', 'wallet']),
2462+
wallet: {
2463+
...this,
2464+
bitgo: _.omit(this.bitgo, ['_token']),
2465+
},
2466+
};
24532467
}
24542468
throw error;
24552469
}

0 commit comments

Comments
 (0)