Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,19 @@ func validateTraceID(id string) string {
if len(id) > 128 {
id = id[:128]
}
// Fast path: most trace IDs (UUIDs, hex) are already clean.
// Scan first to avoid strings.Builder allocation.
clean := true
for i := 0; i < len(id); i++ {
if id[i] < 0x20 || id[i] > 0x7E {
clean = false
break
}
}
if clean {
return id
}
// Slow path: sanitize dirty input.
var b strings.Builder
b.Grow(len(id))
for i := 0; i < len(id); i++ {
Expand Down
Loading