Skip to content

Commit 2b36bdd

Browse files
zeripathtechknowlogick
authored andcommitted
Do not display the raw OpenID error in the UI (#5705)
* 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.
1 parent bf7a112 commit 2b36bdd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routers/user/auth_openid.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func SignInOpenIDPost(ctx *context.Context, form auth.SignInOpenIDForm) {
115115
redirectTo := setting.AppURL + "user/login/openid"
116116
url, err := openid.RedirectURL(id, redirectTo, setting.AppURL)
117117
if err != nil {
118-
ctx.RenderWithErr(err.Error(), tplSignInOpenID, &form)
118+
log.Error(1, "Error in OpenID redirect URL: %s, %v", redirectTo, err.Error())
119+
ctx.RenderWithErr(fmt.Sprintf("Unable to find OpenID provider in %s", redirectTo), tplSignInOpenID, &form)
119120
return
120121
}
121122

0 commit comments

Comments
 (0)