Skip to content

Commit

Permalink
require sso redirect url to be an argo url (#6211)
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Goode <brandon.goode@cox.com>

Co-authored-by: Alex Collins <alexec@users.noreply.github.com>
  • Loading branch information
brgoode and alexec authored Jul 9, 2021
1 parent e790e22 commit d07d933
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/auth/sso/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,14 @@ func (s *sso) HandleCallback(w http.ResponseWriter, r *http.Request) {
Secure: s.secure,
})
redirect := s.baseHRef
if cookie.Value != "" {

proto := "http"
if s.secure {
proto = "https"
}
prefix := fmt.Sprintf("%s://%s%s", proto, r.Host, s.baseHRef)

if strings.HasPrefix(cookie.Value, prefix) {
redirect = cookie.Value
}
http.Redirect(w, r, redirect, 302)
Expand Down

0 comments on commit d07d933

Please sign in to comment.