From 256b1a35615487f27878422f877f25be3f066f54 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 31 May 2021 07:54:16 +0100 Subject: [PATCH] Fix bug in reverse proxy (#16026) Unfortunately go panics you try to cast a nil interface{} as another primitive therefore you need to check interfaces are not nil before casting. Fix #16025 Signed-off-by: Andrew Thornton Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick --- modules/auth/sso/reverseproxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/auth/sso/reverseproxy.go b/modules/auth/sso/reverseproxy.go index f8d17a3cf..3fffee032 100644 --- a/modules/auth/sso/reverseproxy.go +++ b/modules/auth/sso/reverseproxy.go @@ -79,7 +79,7 @@ func (r *ReverseProxy) VerifyAuthData(req *http.Request, w http.ResponseWriter, // Make sure requests to API paths, attachment downloads, git and LFS do not create a new session if !middleware.IsAPIPath(req) && !isAttachmentDownload(req) && !isGitRawOrLFSPath(req) { - if sess.Get("uid").(int64) != user.ID { + if sess != nil && (sess.Get("uid") == nil || sess.Get("uid").(int64) != user.ID) { handleSignIn(w, req, sess, user) } }