[release-11.5.4] [IAM] Prepend AppSubURL to redirectURI before validating it (#103771)
[IAM] Prepend AppSubURL to redirectURI before validating it (#103475)
(cherry picked from commit 5053aa576d)
This commit is contained in:
@@ -89,11 +89,11 @@ func (hs *HTTPServer) RotateUserAuthTokenRedirect(c *contextmodel.ReqContext) re
|
||||
return response.Redirect(hs.GetRedirectURL(c))
|
||||
}
|
||||
|
||||
redirectTo := c.Query("redirectTo")
|
||||
redirectTo := hs.Cfg.AppSubURL + c.Query("redirectTo")
|
||||
if err := hs.ValidateRedirectTo(redirectTo); err != nil {
|
||||
return response.Redirect(hs.Cfg.AppSubURL + "/")
|
||||
}
|
||||
return response.Redirect(hs.Cfg.AppSubURL + redirectTo)
|
||||
return response.Redirect(redirectTo)
|
||||
}
|
||||
|
||||
// swagger:route POST /user/auth-tokens/rotate
|
||||
|
||||
@@ -283,7 +283,7 @@ func handleLogin(r *http.Request, w http.ResponseWriter, cfg *setting.Cfg, ident
|
||||
scopedRedirectToCookie, err := r.Cookie(redirectToCookieName)
|
||||
if err == nil {
|
||||
redirectTo, _ := url.QueryUnescape(scopedRedirectToCookie.Value)
|
||||
if redirectTo != "" && validator(redirectTo) == nil {
|
||||
if redirectTo != "" && validator(cfg.AppSubURL+redirectTo) == nil {
|
||||
redirectURL = cfg.AppSubURL + redirectTo
|
||||
}
|
||||
cookies.DeleteCookie(w, redirectToCookieName, cookieOptions(cfg))
|
||||
|
||||
Reference in New Issue
Block a user