Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request #359 from jehiah/redirect_check_359
Browse files Browse the repository at this point in the history
Improve redirect checks
  • Loading branch information
jehiah authored Mar 29, 2017
2 parents 712739f + 289a6cc commit 86d0832
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
}

redirect := req.Form.Get("state")
if !strings.HasPrefix(redirect, "/") {
if !strings.HasPrefix(redirect, "/") || strings.HasPrefix(redirect, "//") {
redirect = "/"
}

Expand Down
2 changes: 1 addition & 1 deletion providers/provider_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (p *ProviderData) GetLoginURL(redirectURI, finalRedirect string) string {
params.Add("scope", p.Scope)
params.Set("client_id", p.ClientID)
params.Set("response_type", "code")
if strings.HasPrefix(finalRedirect, "/") {
if strings.HasPrefix(finalRedirect, "/") && !strings.HasPrefix(finalRedirect,"//") {
params.Add("state", finalRedirect)
}
a.RawQuery = params.Encode()
Expand Down

0 comments on commit 86d0832

Please sign in to comment.