Skip to content

Commit 9a1c8b0

Browse files
authored
Merge pull request #29 from ewdlop/alert-autofix-3
Potential fix for code scanning alert no. 3: Clear-text logging of sensitive information
2 parents 39e0827 + 1def80a commit 9a1c8b0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

App/scripts/interact.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ const web3 = new Web3('http://localhost:8545');
2424

2525
const account = process.env.ACCOUNT_ADDRESS;
2626

27-
logger.info(`Account address: ${account}`); // Log the account address
27+
function maskAccountAddress(address) {
28+
if (address && address.length > 10) {
29+
return address.substring(0, 6) + '...' + address.substring(address.length - 4);
30+
}
31+
return address;
32+
}
33+
34+
logger.info(`Account address: ${maskAccountAddress(account)}`); // Log the masked account address
2835

2936
// Example usage of different log levels:
3037
// logger.debug('This is a debug message.');

0 commit comments

Comments
 (0)