diff --git a/src/github.com/matrix-org/go-neb/realms/github/github.go b/src/github.com/matrix-org/go-neb/realms/github/github.go index 6305b90..b928282 100644 --- a/src/github.com/matrix-org/go-neb/realms/github/github.go +++ b/src/github.com/matrix-org/go-neb/realms/github/github.go @@ -96,7 +96,11 @@ func (r *githubRealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request failWith(logger, w, 400, "Provided ?state= param is not recognised.", err) return } - ghSession := session.(*githubSession) + ghSession, ok := session.(*githubSession) + if !ok { + failWith(logger, w, 500, "Unexpected session found.", nil) + return + } logger.WithField("user_id", ghSession.UserID()).Print("Mapped redirect to user") // exchange code for access_token