Skip to content

Commit

Permalink
reject requests with special chars in the params
Browse files Browse the repository at this point in the history
Signed-off-by: kpacha <[email protected]>
  • Loading branch information
kpacha committed Nov 17, 2022
1 parent acf6b01 commit 1ec59bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion router/gin/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"net/textproto"
"net/url"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -130,7 +131,7 @@ func paramChecker() gin.HandlerFunc {
c.AbortWithStatus(http.StatusBadRequest)
return
}
if s != param.Value {
if s != param.Value || strings.Contains(s, "?") || strings.Contains(s, "#") {
c.String(http.StatusBadRequest, "error: encoded url params")
c.AbortWithStatus(http.StatusBadRequest)
return
Expand Down

0 comments on commit 1ec59bb

Please sign in to comment.