Skip to content

Commit 256b1a3

Browse files
zeripathlunnytechknowlogick
authored
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 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 3183a46 commit 256b1a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/auth/sso/reverseproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (r *ReverseProxy) VerifyAuthData(req *http.Request, w http.ResponseWriter,
7979

8080
// Make sure requests to API paths, attachment downloads, git and LFS do not create a new session
8181
if !middleware.IsAPIPath(req) && !isAttachmentDownload(req) && !isGitRawOrLFSPath(req) {
82-
if sess.Get("uid").(int64) != user.ID {
82+
if sess != nil && (sess.Get("uid") == nil || sess.Get("uid").(int64) != user.ID) {
8383
handleSignIn(w, req, sess, user)
8484
}
8585
}

0 commit comments

Comments
 (0)