Skip to content

Commit

Permalink
Merge pull request #624 from luraproject/reject_reserved_chars_in_params
Browse files Browse the repository at this point in the history
reject requests with special chars in the params
  • Loading branch information
kpacha authored Nov 17, 2022
2 parents acf6b01 + 1ec59bb commit 974703c
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 974703c

Please sign in to comment.