Skip to content

Commit

Permalink
Add some more escapes to the query sanitizer
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Hughes <[email protected]>
  • Loading branch information
tomhughes committed Jul 4, 2023
1 parent d01184f commit 099d3dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ func sanitizeQuery(q string) string {
q = strings.Join(strings.Fields(q), " ")
q = strings.Replace(q, "(", "\\(", -1)
q = strings.Replace(q, ")", "\\)", -1)
q = strings.Replace(q, "[", "\\[", -1)
q = strings.Replace(q, "]", "\\]", -1)
q = strings.Replace(q, "{", "\\{", -1)
q = strings.Replace(q, "}", "\\}", -1)
q = strings.Replace(q, "*", "\\*", -1)
q = strings.Replace(q, "^", "\\^", -1)
q = strings.Replace(q, "$", "\\$", -1)
return q
}

0 comments on commit 099d3dd

Please sign in to comment.