mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
Potential fix for code scanning alert no. 6: Clear-text logging of sensitive information
Romeo Rosete Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
6768ef8738
commit
75d31572bb
1 changed files with 14 additions and 2 deletions
|
|
@ -1086,8 +1086,20 @@ func GenDoc(ctx *cli.Context) error {
|
||||||
output []string
|
output []string
|
||||||
add = func(name, desc string, v interface{}) {
|
add = func(name, desc string, v interface{}) {
|
||||||
// Sanitize sensitive fields before logging
|
// Sanitize sensitive fields before logging
|
||||||
if req, ok := v.(*core.UserInputRequest); ok && req.IsPassword {
|
switch req := v.(type) {
|
||||||
req.IsPassword = false // Obfuscate sensitive metadata
|
case *core.UserInputRequest:
|
||||||
|
if req.IsPassword {
|
||||||
|
req.IsPassword = false // Obfuscate sensitive metadata
|
||||||
|
}
|
||||||
|
case *core.SignDataRequest:
|
||||||
|
req.Rawdata = nil // Remove raw data to avoid logging sensitive information
|
||||||
|
for i := range req.Messages {
|
||||||
|
req.Messages[i].Value = "[REDACTED]" // Obfuscate message content
|
||||||
|
}
|
||||||
|
case *core.ListRequest:
|
||||||
|
for i := range req.Accounts {
|
||||||
|
req.Accounts[i].URL.Path = "[REDACTED]" // Obfuscate account paths
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if data, err := json.MarshalIndent(v, "", " "); err == nil {
|
if data, err := json.MarshalIndent(v, "", " "); err == nil {
|
||||||
output = append(output, fmt.Sprintf("### %s\n\n%s\n\nExample:\n```json\n%s\n```", name, desc, data))
|
output = append(output, fmt.Sprintf("### %s\n\n%s\n\nExample:\n```json\n%s\n```", name, desc, data))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue