Skip to content

Commit

Permalink
bug: account for etcd leader changes error
Browse files Browse the repository at this point in the history
if we fail to read the secret from etcd we should return an internal
server error and not an unauthorized error.
  • Loading branch information
ricardomaraschini committed Nov 18, 2024
1 parent 9ae5c14 commit c9e8915
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/handlers/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func RequireValidSessionQuietMiddleware(kotsStore store.Store) mux.MiddlewareFun
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sess, err := requireValidSession(kotsStore, w, r)
if err != nil {
logger.Errorf("failed validating session: %s", err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func requireValidSession(kotsStore store.Store, w http.ResponseWriter, r *http.R
passwordUpdatedAt, err := kotsStore.GetPasswordUpdatedAt()
if err != nil {
response := types.ErrorResponse{Error: util.StrPointer("failed to validate session with current password")}
JSON(w, http.StatusUnauthorized, response)
JSON(w, http.StatusInternalServerError, response)
return nil, err
}
if passwordUpdatedAt != nil && passwordUpdatedAt.After(sess.IssuedAt) {
Expand Down

0 comments on commit c9e8915

Please sign in to comment.