mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge pull request #16 from roseteromeo56/alert-autofix-7
Potential fix for code scanning alert no. 7: Clear-text logging of sensitive information
This commit is contained in:
commit
48cebc7721
1 changed files with 8 additions and 1 deletions
|
|
@ -31,6 +31,12 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// sanitizeMessage redacts sensitive information from the input string.
|
||||||
|
func sanitizeMessage(message string) string {
|
||||||
|
// Example: Replace occurrences of "password: <value>" with "password: [REDACTED]"
|
||||||
|
return strings.ReplaceAll(message, "password:", "password: [REDACTED]")
|
||||||
|
}
|
||||||
|
|
||||||
type CommandlineUI struct {
|
type CommandlineUI struct {
|
||||||
in *bufio.Reader
|
in *bufio.Reader
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|
@ -237,7 +243,8 @@ func (ui *CommandlineUI) ShowError(message string) {
|
||||||
|
|
||||||
// ShowInfo displays info message to user
|
// ShowInfo displays info message to user
|
||||||
func (ui *CommandlineUI) ShowInfo(message string) {
|
func (ui *CommandlineUI) ShowInfo(message string) {
|
||||||
fmt.Printf("## Info \n%s\n", message)
|
sanitizedMessage := sanitizeMessage(message)
|
||||||
|
fmt.Printf("## Info \n%s\n", sanitizedMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ui *CommandlineUI) OnApprovedTx(tx ethapi.SignTransactionResult) {
|
func (ui *CommandlineUI) OnApprovedTx(tx ethapi.SignTransactionResult) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue