Skip to content

Commit 8a402bf

Browse files
committed
escape [ ] for json injection
1 parent ee072b2 commit 8a402bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internals/proxy/proxy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ func parseTypedQuery(values []string) interface{} {
3434
intValue, err := strconv.Atoi(raw)
3535

3636
if strings.Contains(raw, ",") || (strings.Contains(raw, "[") && strings.Contains(raw, "]")) {
37+
if strings.Contains(raw, "[") && strings.Contains(raw, "]") {
38+
escapedStr := strings.ReplaceAll(raw, "[", "")
39+
escapedStr = strings.ReplaceAll(escapedStr, "]", "")
40+
raw = escapedStr
41+
}
42+
3743
parts := strings.Split(raw, ",")
3844

3945
var list []interface{}

0 commit comments

Comments
 (0)