Skip to content

Commit

Permalink
server: bail out of auth mux if cluster version not yet initialized
Browse files Browse the repository at this point in the history
This fixes cockroachdb#25771, in which the auth mux was using the internal executor
to run SQL before the cluster version, which the internal executor is
dependent upon, was initialized.

A preferable solution would be to not register any handlers using the
auth mux until the cluster setting is initialized, but it's not
immediately apparent what reordering of things in Server.Start would
achieve this without breaking anything else.

Release note: None
  • Loading branch information
Pete Vilter committed Sep 25, 2018
1 parent 451e753 commit c9d9611
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/server/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ const webSessionUserKeyStr = "webSessionUser"
const webSessionIDKeyStr = "webSessionID"

func (am *authenticationMux) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if !am.server.server.node.storeCfg.Settings.Version.IsInitialized() {
http.Error(w, "cluster version has not yet been initialized", 403)
return
}
username, cookie, err := am.getSession(w, req)
if err == nil {
ctx := req.Context()
Expand Down

0 comments on commit c9d9611

Please sign in to comment.