mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Merge pull request #49 from roseteromeo56/alert-autofix-6
Potential fix for code scanning alert no. 6: Clear-text logging of sensitive information
This commit is contained in:
commit
de7c698419
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 {
|
||||||
|
// 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))
|
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", "entry", name)
|
||||||
|
}
|
||||||
} 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