Security Fix: clean paths correctly to avoid circumvention of BlacklistedPaths

This commit is contained in:
Moritz Marquardt 2023-08-27 10:13:15 +02:00
parent d720d25e42
commit 56d3e291c4
3 changed files with 72 additions and 4 deletions

View file

@ -48,11 +48,9 @@ func (c *Context) Redirect(uri string, statusCode int) {
http.Redirect(c.RespWriter, c.Req, uri, statusCode)
}
// Path returns requested path.
//
// The returned bytes are valid until your request handler returns.
// Path returns the cleaned requested path.
func (c *Context) Path() string {
return c.Req.URL.Path
return utils.CleanPath(c.Req.URL.Path)
}
func (c *Context) Host() string {