Add a warning log when /%23/ characters are detected.

pull/483/head
Clement Michaud 2019-12-06 20:34:35 +01:00 committed by Clément Michaud
parent e21da43fd6
commit cc50a7eec5
1 changed files with 3 additions and 0 deletions

View File

@ -240,6 +240,9 @@ func VerifyGet(ctx *middlewares.AutheliaCtx) {
rd := string(ctx.QueryArgs().Peek("rd")) rd := string(ctx.QueryArgs().Peek("rd"))
if rd != "" { if rd != "" {
redirectionURL := fmt.Sprintf("%s?rd=%s", rd, targetURL.String()) redirectionURL := fmt.Sprintf("%s?rd=%s", rd, targetURL.String())
if strings.Contains(redirectionURL, "/%23/") {
ctx.Logger.Warn("Characters /%23/ have been detected in redirection URL. This is not needed anymore, please strip it")
}
ctx.Redirect(redirectionURL, 302) ctx.Redirect(redirectionURL, 302)
ctx.SetBodyString(fmt.Sprintf("Found. Redirecting to %s", redirectionURL)) ctx.SetBodyString(fmt.Sprintf("Found. Redirecting to %s", redirectionURL))
} else { } else {