mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/stcrashreceiver: Sanitize failure report fingerprints (#7840)
This commit is contained in:
parent
eeb7091180
commit
1ae5ac7d0b
@ -89,7 +89,8 @@ func handleFailureFn(dsn string) func(w http.ResponseWriter, req *http.Request)
|
|||||||
pkt.Extra = raven.Extra{
|
pkt.Extra = raven.Extra{
|
||||||
"count": r.Count,
|
"count": r.Count,
|
||||||
}
|
}
|
||||||
pkt.Fingerprint = []string{r.Description}
|
message := sanitizeMessageLDB(r.Description)
|
||||||
|
pkt.Fingerprint = []string{message}
|
||||||
|
|
||||||
if err := sendReport(dsn, pkt, userIDFor(req)); err != nil {
|
if err := sendReport(dsn, pkt, userIDFor(req)); err != nil {
|
||||||
log.Println("Failed to send failure report:", err)
|
log.Println("Failed to send failure report:", err)
|
||||||
|
@ -143,15 +143,20 @@ var (
|
|||||||
ldbPathRe = regexp.MustCompile(`(open|write|read) .+[\\/].+[\\/]index[^\\/]+[\\/][^\\/]+: `)
|
ldbPathRe = regexp.MustCompile(`(open|write|read) .+[\\/].+[\\/]index[^\\/]+[\\/][^\\/]+: `)
|
||||||
)
|
)
|
||||||
|
|
||||||
func crashReportFingerprint(message string) []string {
|
func sanitizeMessageLDB(message string) string {
|
||||||
// Do not fingerprint on the stack in case of db corruption or fatal
|
|
||||||
// db io error - where it occurs doesn't matter.
|
|
||||||
orig := message
|
|
||||||
message = ldbPosRe.ReplaceAllString(message, "${1}x)")
|
message = ldbPosRe.ReplaceAllString(message, "${1}x)")
|
||||||
message = ldbFileRe.ReplaceAllString(message, "${1}x${3}")
|
message = ldbFileRe.ReplaceAllString(message, "${1}x${3}")
|
||||||
message = ldbChecksumRe.ReplaceAllString(message, "${1}X${3}X")
|
message = ldbChecksumRe.ReplaceAllString(message, "${1}X${3}X")
|
||||||
message = ldbInternalKeyRe.ReplaceAllString(message, "${1}x${2}x")
|
message = ldbInternalKeyRe.ReplaceAllString(message, "${1}x${2}x")
|
||||||
message = ldbPathRe.ReplaceAllString(message, "$1 x: ")
|
message = ldbPathRe.ReplaceAllString(message, "$1 x: ")
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
|
||||||
|
func crashReportFingerprint(message string) []string {
|
||||||
|
// Do not fingerprint on the stack in case of db corruption or fatal
|
||||||
|
// db io error - where it occurs doesn't matter.
|
||||||
|
orig := message
|
||||||
|
message = sanitizeMessageLDB(message)
|
||||||
if message != orig {
|
if message != orig {
|
||||||
return []string{message}
|
return []string{message}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user