diff options
author | zeripath <art27@cantab.net> | 2021-05-31 07:54:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 02:54:16 -0400 |
commit | 256b1a35615487f27878422f877f25be3f066f54 (patch) | |
tree | 5640acec002f9781e06bb26323c2f6aa01ef7204 /modules/auth | |
parent | 3183a465d71a13535e52589bb85b987176872fcd (diff) | |
download | gitea-256b1a35615487f27878422f877f25be3f066f54.tar.gz gitea-256b1a35615487f27878422f877f25be3f066f54.zip |
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 <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/sso/reverseproxy.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/auth/sso/reverseproxy.go b/modules/auth/sso/reverseproxy.go index f8d17a3cf5..3fffee0320 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) } } |