Skip to content

Commit

Permalink
Do not display the raw OpenID error in the UI (#5705)
Browse files Browse the repository at this point in the history
* Do not display the raw OpenID error in the UI

If there are no `WHITELIST_URIS` or `BLACKLIST_URIS` set in the openid
section of the app.ini, it is possible that gitea can leak sensitive
information about the local network through the error provided by the
UI. This PR hides the error information and logs it.

Fix #4973

Signed-off-by: Andrew Thornton <[email protected]>

* Update auth_openid.go

Place error log within the `err != nil` branch.
  • Loading branch information
zeripath authored and techknowlogick committed Jan 12, 2019
1 parent bf7a112 commit 2b36bdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routers/user/auth_openid.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ func SignInOpenIDPost(ctx *context.Context, form auth.SignInOpenIDForm) {
redirectTo := setting.AppURL + "user/login/openid"
url, err := openid.RedirectURL(id, redirectTo, setting.AppURL)
if err != nil {
ctx.RenderWithErr(err.Error(), tplSignInOpenID, &form)
log.Error(1, "Error in OpenID redirect URL: %s, %v", redirectTo, err.Error())
ctx.RenderWithErr(fmt.Sprintf("Unable to find OpenID provider in %s", redirectTo), tplSignInOpenID, &form)
return
}

Expand Down

0 comments on commit 2b36bdd

Please sign in to comment.