Fix server.GetIndexes userInfo logic

userInfo at the relevant line can be nil here. We check later if the
userInfo != nil (and assure it passes authn/authz) or if userInfo == nil
then we return all the indexes we can find.

(cherry picked from commit 407d52baa0)
This commit is contained in:
Garrison Davis 2022-11-04 14:14:35 -06:00 committed by Fletcher Haynes
parent ab2b48da0d
commit 13a32409f3

View file

@ -464,10 +464,7 @@ func (h *GRPCHandler) GetIndex(ctx context.Context, req *pb.GetIndexRequest) (*p
// GetIndexes returns a list of all Indexes
func (h *GRPCHandler) GetIndexes(ctx context.Context, req *pb.GetIndexesRequest) (*pb.GetIndexesResponse, error) {
userInfo, ok := authn.GetUserInfo(ctx)
if !ok {
return nil, status.Error(codes.InvalidArgument, "malformed auth header")
}
userInfo, _ := authn.GetUserInfo(ctx) // nil is a valid userInfo here
schema, err := h.api.Schema(ctx, false)
if err != nil {
return nil, errToStatusError(err)