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
a244e40f0d
commit
c30bb9e638
1 changed files with 9 additions and 5 deletions
|
|
@ -1104,7 +1104,12 @@ func GenDoc(ctx *cli.Context) error {
|
||||||
req.Meta = core.Metadata{} // Clear metadata to avoid leaking sensitive information
|
req.Meta = core.Metadata{} // Clear metadata to avoid leaking sensitive information
|
||||||
}
|
}
|
||||||
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))
|
// Final validation to ensure no sensitive data is logged
|
||||||
|
if strings.Contains(string(data), "[REDACTED]") {
|
||||||
|
output = append(output, fmt.Sprintf("### %s\n\n%s\n\nExample:\n```json\n%s\n```", name, desc, data))
|
||||||
|
} else {
|
||||||
|
log.Error("Sensitive data detected in output, skipping logging")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Error("Error generating output", "err", err)
|
log.Error("Error generating output", "err", err)
|
||||||
}
|
}
|
||||||
|
|
@ -1232,11 +1237,10 @@ func GenDoc(ctx *cli.Context) error {
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(`## UI Client interface
|
log.Info("## UI Client interface")
|
||||||
|
log.Info("These data types are defined in the channel between clef and the UI")
|
||||||
These data types are defined in the channel between clef and the UI`)
|
|
||||||
for _, elem := range output {
|
for _, elem := range output {
|
||||||
fmt.Println(elem)
|
log.Info(elem)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue