Skip to content

Commit dfb486d

Browse files
authored
Merge pull request #7929 from BitGo/WP-7489
fix: sanitize wallet object from logs
2 parents 15d535c + 8465744 commit dfb486d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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
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)