CVE-2023-41891 (published 2023-10-30T19:15Z)

FlyteAdmin is the control plane for Flyte responsible for managing entities and administering workflow executions. Prior to version 1.1.124, list endpoints on FlyteAdmin have a SQL vulnerability where a malicious user can send a REST request with custom SQL statements as list filters. The attacker needs to have access to the FlyteAdmin installation, typically either behind a VPN or authentication. Version 1.1.124 contains a patch for this issue.

CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/flyteorg/flyteadmin
commit_details: repo_url: https://github.com/flyteorg/flyteadmin
author: Iaroslav Ciupin
author_date: 2023-09-01 00:21:05+03:00
msg: Merge pull request from GHSA-r847-6w6h-r8g4

* Fix list filters

* Fix sort keys

* split into 2 maps

* move columns to models

* move columns to models
repository: repo_url: https://github.com/flyteorg/flyteadmin
repo_name: flyteorg/flyteadmin
description: Control Plane for Flyte. Flyteadmin is a gRPC + REST Service written in golang and uses a RDBMs to store meta information and management information for Flyte Tasks and Workflows.
repo_language: Go
owner: flyteorg
file_changes: filename: admin_service_data_provider.go
change_type: ModificationType.MODIFY
diff: @@ -4,9 +4,12 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/flyteorg/flyteadmin/pkg/clusterresource/interfaces"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/service"
+
+	"github.com/flyteorg/flyteadmin/pkg/clusterresource/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/common"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 )
 
 // Implementation of an interfaces.FlyteAdminDataProvider which fetches data using a flyteadmin service client
@@ -32,6 +35,13 @@ func (p serviceAdminProvider) GetClusterResourceAttributes(ctx context.Context,
 
 var activeProjectsFilter = fmt.Sprintf("ne(state,%d)", admin.Project_ARCHIVED)
 
+var descCreatedAtSortParam = admin.Sort{
+	Direction: admin.Sort_DESCENDING,
+	Key:       "created_at",
+}
+
+var descCreatedAtSortDBParam, _ = common.NewSortParameter(&descCreatedAtSortParam, models.ProjectColumns)
+
 func (p serviceAdminProvider) GetProjects(ctx context.Context) (*admin.Projects, error) {
 	projects := make([]*admin.Project, 0)
 	listReq := &admin.ProjectListRequest{

programming_language: Go
filename: shared.go
change_type: ModificationType.MODIFY
diff: @@ -1,19 +1,10 @@
 package impl
 
 import (
-	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"google.golang.org/grpc/codes"
 )
 
 func NewMissingEntityError(entity string) error {
 	return errors.NewFlyteAdminErrorf(codes.NotFound, "Failed to find [%s]", entity)
 }
-
-var descCreatedAtSortParam = admin.Sort{
-	Direction: admin.Sort_DESCENDING,
-	Key:       "created_at",
-}
-
-var descCreatedAtSortDBParam, _ = common.NewSortParameter(descCreatedAtSortParam)

programming_language: Go
filename: sorting.go
change_type: ModificationType.MODIFY
diff: @@ -2,6 +2,7 @@ package common
 
 import (
 	"fmt"
+	"k8s.io/apimachinery/pkg/util/sets"
 
 	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
@@ -23,13 +24,22 @@ func (s *sortParamImpl) GetGormOrderExpr() string {
 	return s.gormOrderExpression
 }
 
-func NewSortParameter(sort admin.Sort) (SortParameter, error) {
+func NewSortParameter(sort *admin.Sort, allowed sets.String) (SortParameter, error) {
+	if sort == nil {
+		return nil, nil
+	}
+
+	key := sort.Key
+	if !allowed.Has(key) {
+		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "invalid sort key '%s'", key)
+	}
+
 	var gormOrderExpression string
 	switch sort.Direction {
 	case admin.Sort_DESCENDING:
-		gormOrderExpression = fmt.Sprintf(gormDescending, sort.Key)
+		gormOrderExpression = fmt.Sprintf(gormDescending, key)
 	case admin.Sort_ASCENDING:
-		gormOrderExpression = fmt.Sprintf(gormAscending, sort.Key)
+		gormOrderExpression = fmt.Sprintf(gormAscending, key)
 	default:
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "invalid sort order specified: %v", sort)
 	}

programming_language: Go
filename: sorting_test.go
change_type: ModificationType.MODIFY
diff: @@ -3,24 +3,53 @@ package common
 import (
 	"testing"
 
+	"k8s.io/apimachinery/pkg/util/sets"
+
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/stretchr/testify/assert"
 )
 
+func TestSortParameter_Nil(t *testing.T) {
+	sortParameter, err := NewSortParameter(nil, nil)
+
+	assert.NoError(t, err)
+	assert.Nil(t, sortParameter)
+}
+
+func TestSortParameter_InvalidSortKey(t *testing.T) {
+	_, err := NewSortParameter(&admin.Sort{
+		Direction: admin.Sort_ASCENDING,
+		Key:       "wrong",
+	}, sets.NewString("name"))
+
+	assert.EqualError(t, err, "invalid sort key 'wrong'")
+}
+
+func TestSortParameter_InvalidSortDirection(t *testing.T) {
+	_, err := NewSortParameter(&admin.Sort{
+		Direction: 2,
+		Key:       "name",
+	}, sets.NewString("name"))
+
+	assert.EqualError(t, err, `invalid sort order specified: key:"name" direction:2 `)
+}
+
 func TestSortParameter_Ascending(t *testing.T) {
-	sortParameter, err := NewSortParameter(admin.Sort{
+	sortParameter, err := NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_ASCENDING,
 		Key:       "name",
-	})
-	assert.Nil(t, err)
+	}, sets.NewString("name"))
+
+	assert.NoError(t, err)
 	assert.Equal(t, "name asc", sortParameter.GetGormOrderExpr())
 }
 
 func TestSortParameter_Descending(t *testing.T) {
-	sortParameter, err := NewSortParameter(admin.Sort{
+	sortParameter, err := NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
 		Key:       "project",
-	})
-	assert.Nil(t, err)
+	}, sets.NewString("project"))
+
+	assert.NoError(t, err)
 	assert.Equal(t, "project desc", sortParameter.GetGormOrderExpr())
 }

programming_language: Go
filename: description_entity_manager.go
change_type: ModificationType.MODIFY
diff: @@ -4,22 +4,22 @@ import (
 	"context"
 	"strconv"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	"github.com/flyteorg/flytestdlib/contextutils"
+	"github.com/flyteorg/flytestdlib/logger"
+	"github.com/flyteorg/flytestdlib/promutils"
+	"google.golang.org/grpc/codes"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
-
 	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flytestdlib/contextutils"
-	"github.com/flyteorg/flytestdlib/logger"
-	"github.com/flyteorg/flytestdlib/promutils"
-	"google.golang.org/grpc/codes"
 )
 
 type DescriptionEntityMetrics struct {
@@ -65,13 +65,12 @@ func (d *DescriptionEntityManager) ListDescriptionEntity(ctx context.Context, re
 		logger.Error(ctx, "failed to get database filter")
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.DescriptionEntityColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,

programming_language: Go
filename: execution_manager.go
change_type: ModificationType.MODIFY
diff: @@ -6,34 +6,32 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/flyteorg/flytestdlib/promutils/labeled"
-
-	"github.com/flyteorg/flyteadmin/plugins"
-
+	"github.com/benbjohnson/clock"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/flytek8s"
-
-	"github.com/flyteorg/flyteadmin/auth"
-
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/resources"
-
-	dataInterfaces "github.com/flyteorg/flyteadmin/pkg/data/interfaces"
 	"github.com/flyteorg/flytestdlib/contextutils"
+	"github.com/flyteorg/flytestdlib/logger"
 	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/promutils/labeled"
+	"github.com/flyteorg/flytestdlib/storage"
+	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/ptypes"
 	"github.com/golang/protobuf/ptypes/timestamp"
 	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
-	"github.com/flyteorg/flyteadmin/pkg/common"
-
-	"github.com/flyteorg/flytestdlib/logger"
-	"github.com/flyteorg/flytestdlib/storage"
-
+	"github.com/flyteorg/flyteadmin/auth"
 	cloudeventInterfaces "github.com/flyteorg/flyteadmin/pkg/async/cloudevent/interfaces"
 	eventWriter "github.com/flyteorg/flyteadmin/pkg/async/events/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/async/notifications"
 	notificationInterfaces "github.com/flyteorg/flyteadmin/pkg/async/notifications/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/common"
+	dataInterfaces "github.com/flyteorg/flyteadmin/pkg/data/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/executions"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/resources"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
@@ -42,13 +40,7 @@ import (
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
 	workflowengineInterfaces "github.com/flyteorg/flyteadmin/pkg/workflowengine/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"google.golang.org/grpc/codes"
-
-	"github.com/benbjohnson/clock"
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
-	"github.com/golang/protobuf/proto"
+	"github.com/flyteorg/flyteadmin/plugins"
 )
 
 const childContainerQueueKey = "child_queue"
@@ -1434,12 +1426,10 @@ func (m *ExecutionManager) ListExecutions(
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.ExecutionColumns)
+	if err != nil {
+		return nil, err
 	}
 
 	offset, err := validation.ValidateToken(request.Token)

programming_language: Go
filename: execution_manager_test.go
change_type: ModificationType.MODIFY
diff: @@ -3,64 +3,54 @@ package impl
 import (
 	"context"
 	"errors"
+	"fmt"
 	"strings"
 	"testing"
-
-	"github.com/flyteorg/flyteadmin/plugins"
-
-	"google.golang.org/grpc/status"
-
-	"google.golang.org/protobuf/types/known/timestamppb"
+	"time"
 
 	"github.com/benbjohnson/clock"
-	"github.com/flyteorg/flyteadmin/pkg/common"
-	commonTestUtils "github.com/flyteorg/flyteadmin/pkg/common/testutils"
-	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/executions"
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
-	managerInterfaces "github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
-	managerMocks "github.com/flyteorg/flyteadmin/pkg/manager/mocks"
-	"github.com/flyteorg/flyteadmin/pkg/runtime"
 	"github.com/flyteorg/flyteidl/clients/go/coreutils"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/event"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/storage"
 	"github.com/gogo/protobuf/jsonpb"
+	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/ptypes"
+	"github.com/golang/protobuf/ptypes/wrappers"
+	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"google.golang.org/grpc/codes"
-
+	"google.golang.org/grpc/status"
+	"google.golang.org/protobuf/types/known/timestamppb"
 	"k8s.io/apimachinery/pkg/api/resource"
-
-	eventWriterMocks "github.com/flyteorg/flyteadmin/pkg/async/events/mocks"
 	"k8s.io/apimachinery/pkg/util/sets"
 
 	"github.com/flyteorg/flyteadmin/auth"
-
-	commonMocks "github.com/flyteorg/flyteadmin/pkg/common/mocks"
-
-	"github.com/flyteorg/flytestdlib/storage"
-
-	"time"
-
-	"fmt"
-
+	eventWriterMocks "github.com/flyteorg/flyteadmin/pkg/async/events/mocks"
 	notificationMocks "github.com/flyteorg/flyteadmin/pkg/async/notifications/mocks"
+	"github.com/flyteorg/flyteadmin/pkg/common"
+	commonMocks "github.com/flyteorg/flyteadmin/pkg/common/mocks"
+	commonTestUtils "github.com/flyteorg/flyteadmin/pkg/common/testutils"
 	dataMocks "github.com/flyteorg/flyteadmin/pkg/data/mocks"
+	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/executions"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/testutils"
+	managerInterfaces "github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
+	managerMocks "github.com/flyteorg/flyteadmin/pkg/manager/mocks"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	repositoryMocks "github.com/flyteorg/flyteadmin/pkg/repositories/mocks"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
+	"github.com/flyteorg/flyteadmin/pkg/runtime"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
 	runtimeIFaceMocks "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces/mocks"
 	runtimeMocks "github.com/flyteorg/flyteadmin/pkg/runtime/mocks"
 	workflowengineInterfaces "github.com/flyteorg/flyteadmin/pkg/workflowengine/interfaces"
 	workflowengineMocks "github.com/flyteorg/flyteadmin/pkg/workflowengine/mocks"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-	"github.com/golang/protobuf/proto"
-	"github.com/golang/protobuf/ptypes/wrappers"
-	"github.com/stretchr/testify/assert"
+	"github.com/flyteorg/flyteadmin/plugins"
 )
 
 var spec = testutils.GetExecutionRequest().Spec
@@ -2979,7 +2969,7 @@ func TestListExecutions(t *testing.T) {
 		assert.True(t, domainFilter, "Missing domain equality filter")
 		assert.False(t, nameFilter, "Included name equality filter")
 		assert.Equal(t, limit, input.Limit)
-		assert.Equal(t, "domain asc", input.SortParameter.GetGormOrderExpr())
+		assert.Equal(t, "execution_domain asc", input.SortParameter.GetGormOrderExpr())
 		assert.Equal(t, 2, input.Offset)
 		assert.EqualValues(t, map[common.Entity]bool{
 			common.Execution: true,
@@ -3027,7 +3017,7 @@ func TestListExecutions(t *testing.T) {
 		Limit: limit,
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 		Token: "2",
 	})
@@ -3965,7 +3955,7 @@ func TestListExecutions_LegacyModel(t *testing.T) {
 		assert.True(t, domainFilter, "Missing domain equality filter")
 		assert.False(t, nameFilter, "Included name equality filter")
 		assert.Equal(t, limit, input.Limit)
-		assert.Equal(t, "domain asc", input.SortParameter.GetGormOrderExpr())
+		assert.Equal(t, "execution_domain asc", input.SortParameter.GetGormOrderExpr())
 		assert.Equal(t, 2, input.Offset)
 		return interfaces.ExecutionCollectionOutput{
 			Executions: []models.Execution{
@@ -4010,7 +4000,7 @@ func TestListExecutions_LegacyModel(t *testing.T) {
 		Limit: limit,
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 		Token: "2",
 	})

programming_language: Go
filename: launch_plan_manager.go
change_type: ModificationType.MODIFY
diff: @@ -5,15 +5,16 @@ import (
 	"context"
 	"strconv"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/contextutils"
-
+	"github.com/flyteorg/flytestdlib/logger"
 	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/golang/protobuf/proto"
 	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
 	scheduleInterfaces "github.com/flyteorg/flyteadmin/pkg/async/schedule/interfaces"
-
-	"github.com/flyteorg/flytestdlib/logger"
-
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
@@ -23,10 +24,6 @@ import (
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"github.com/golang/protobuf/proto"
-	"google.golang.org/grpc/codes"
 )
 
 type launchPlanMetrics struct {
@@ -408,13 +405,11 @@ func (m *LaunchPlanManager) ListLaunchPlans(ctx context.Context, request admin.R
 		return nil, err
 	}
 
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.LaunchPlanColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,
@@ -463,13 +458,11 @@ func (m *LaunchPlanManager) ListActiveLaunchPlans(ctx context.Context, request a
 		return nil, err
 	}
 
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.LaunchPlanColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,
@@ -514,13 +507,12 @@ func (m *LaunchPlanManager) ListLaunchPlanIds(ctx context.Context, request admin
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.LaunchPlanColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "invalid pagination token %s", request.Token)

programming_language: Go
filename: named_entity_manager.go
change_type: ModificationType.MODIFY
diff: @@ -5,23 +5,22 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
 	"github.com/flyteorg/flytestdlib/contextutils"
+	"github.com/flyteorg/flytestdlib/logger"
+	"github.com/flyteorg/flytestdlib/promutils"
+	"google.golang.org/grpc/codes"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
-	"google.golang.org/grpc/codes"
-
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flytestdlib/logger"
-	"github.com/flyteorg/flytestdlib/promutils"
 )
 
 const state = "state"
@@ -119,13 +118,12 @@ func (m *NamedEntityManager) ListNamedEntities(ctx context.Context, request admi
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.NamedEntityColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,

programming_language: Go
filename: node_execution_manager.go
change_type: ModificationType.MODIFY
diff: @@ -2,43 +2,34 @@ package impl
 
 import (
 	"context"
+	"fmt"
 	"strconv"
 
-	cloudeventInterfaces "github.com/flyteorg/flyteadmin/pkg/async/cloudevent/interfaces"
-
-	"github.com/flyteorg/flytestdlib/promutils/labeled"
-
-	eventWriter "github.com/flyteorg/flyteadmin/pkg/async/events/interfaces"
-
-	notificationInterfaces "github.com/flyteorg/flyteadmin/pkg/async/notifications/interfaces"
-	"github.com/golang/protobuf/proto"
-
-	"github.com/flyteorg/flytestdlib/storage"
-
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/contextutils"
-
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
+	"github.com/flyteorg/flytestdlib/logger"
 	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/promutils/labeled"
+	"github.com/flyteorg/flytestdlib/storage"
+	"github.com/golang/protobuf/proto"
 	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
-	"github.com/flyteorg/flytestdlib/logger"
-
+	cloudeventInterfaces "github.com/flyteorg/flyteadmin/pkg/async/cloudevent/interfaces"
+	eventWriter "github.com/flyteorg/flyteadmin/pkg/async/events/interfaces"
+	notificationInterfaces "github.com/flyteorg/flyteadmin/pkg/async/notifications/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/common"
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
-
-	"fmt"
-
 	dataInterfaces "github.com/flyteorg/flyteadmin/pkg/data/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"google.golang.org/grpc/codes"
 )
 
 type nodeExecutionMetrics struct {
@@ -378,13 +369,12 @@ func (m *NodeExecutionManager) listNodeExecutions(
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if sortBy != nil {
-		sortParameter, err = common.NewSortParameter(*sortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(sortBy, models.NodeExecutionColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(requestToken)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,

programming_language: Go
filename: node_execution_manager_test.go
change_type: ModificationType.MODIFY
diff: @@ -15,16 +15,10 @@ import (
 
 	eventWriterMocks "github.com/flyteorg/flyteadmin/pkg/async/events/mocks"
 
-	"github.com/flyteorg/flyteadmin/pkg/manager/impl/testutils"
 	"github.com/flyteorg/flytestdlib/storage"
 
-	"github.com/flyteorg/flyteadmin/pkg/common"
-	commonMocks "github.com/flyteorg/flyteadmin/pkg/common/mocks"
-	dataMocks "github.com/flyteorg/flyteadmin/pkg/data/mocks"
-	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
-	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
-	repositoryMocks "github.com/flyteorg/flyteadmin/pkg/repositories/mocks"
-	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
+	"github.com/flyteorg/flyteadmin/pkg/manager/impl/testutils"
+
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/event"
@@ -33,6 +27,14 @@ import (
 	"github.com/golang/protobuf/ptypes"
 	"github.com/stretchr/testify/assert"
 	"google.golang.org/grpc/codes"
+
+	"github.com/flyteorg/flyteadmin/pkg/common"
+	commonMocks "github.com/flyteorg/flyteadmin/pkg/common/mocks"
+	dataMocks "github.com/flyteorg/flyteadmin/pkg/data/mocks"
+	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	repositoryMocks "github.com/flyteorg/flyteadmin/pkg/repositories/mocks"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 )
 
 var occurredAt = time.Now().UTC()
@@ -807,7 +809,7 @@ func TestListNodeExecutionsLevelZero(t *testing.T) {
 				"parent_task_execution_id": nil,
 			}, filter)
 
-			assert.Equal(t, "domain asc", input.SortParameter.GetGormOrderExpr())
+			assert.Equal(t, "execution_domain asc", input.SortParameter.GetGormOrderExpr())
 			return interfaces.NodeExecutionCollectionOutput{
 				NodeExecutions: []models.NodeExecution{
 					{
@@ -858,10 +860,10 @@ func TestListNodeExecutionsLevelZero(t *testing.T) {
 		Token: "2",
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 	})
-	assert.Nil(t, err)
+	assert.NoError(t, err)
 	assert.Len(t, nodeExecutions.NodeExecutions, 1)
 	assert.True(t, proto.Equal(&admin.NodeExecution{
 		Id: &core.NodeExecutionIdentifier{
@@ -925,7 +927,7 @@ func TestListNodeExecutionsWithParent(t *testing.T) {
 			assert.Equal(t, parentID, queryExpr.Args)
 			assert.Equal(t, "parent_id = ?", queryExpr.Query)
 
-			assert.Equal(t, "domain asc", input.SortParameter.GetGormOrderExpr())
+			assert.Equal(t, "execution_domain asc", input.SortParameter.GetGormOrderExpr())
 			return interfaces.NodeExecutionCollectionOutput{
 				NodeExecutions: []models.NodeExecution{
 					{
@@ -958,7 +960,7 @@ func TestListNodeExecutionsWithParent(t *testing.T) {
 		Token: "2",
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 		UniqueParentId: "parent_1",
 	})
@@ -1075,6 +1077,7 @@ func TestListNodeExecutions_NothingToReturn(t *testing.T) {
 			return interfaces.ExecutionCollectionOutput{}, nil
 		})
 	nodeExecManager := NewNodeExecutionManager(repository, getMockExecutionsConfigProvider(), make([]string, 0), getMockStorageForExecTest(context.Background()), mockScope.NewTestScope(), mockNodeExecutionRemoteURL, nil, nil, &eventWriterMocks.NodeExecutionEventWriter{})
+
 	_, err := nodeExecManager.ListNodeExecutions(context.Background(), admin.NodeExecutionListRequest{
 		WorkflowExecutionId: &core.WorkflowExecutionIdentifier{
 			Project: "project",
@@ -1085,10 +1088,11 @@ func TestListNodeExecutions_NothingToReturn(t *testing.T) {
 		Token: "2",
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 	})
-	assert.Nil(t, err)
+
+	assert.NoError(t, err)
 	assert.False(t, listExecutionsCalled)
 }
 
@@ -1139,7 +1143,7 @@ func TestListNodeExecutionsForTask(t *testing.T) {
 			assert.Equal(t, uint(8), queryExpr.Args)
 			assert.Equal(t, "parent_task_execution_id = ?", queryExpr.Query)
 
-			assert.Equal(t, "domain asc", input.SortParameter.GetGormOrderExpr())
+			assert.Equal(t, "execution_domain asc", input.SortParameter.GetGormOrderExpr())
 			return interfaces.NodeExecutionCollectionOutput{
 				NodeExecutions: []models.NodeExecution{
 					{
@@ -1184,7 +1188,7 @@ func TestListNodeExecutionsForTask(t *testing.T) {
 		Token: "2",
 		SortBy: &admin.Sort{
 			Direction: admin.Sort_ASCENDING,
-			Key:       "domain",
+			Key:       "execution_domain",
 		},
 	})
 	assert.Nil(t, err)

programming_language: Go
filename: project_manager.go
change_type: ModificationType.MODIFY
diff: @@ -4,16 +4,18 @@ import (
 	"context"
 	"strconv"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"google.golang.org/grpc/codes"
+
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/util"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"google.golang.org/grpc/codes"
 )
 
 type ProjectManager struct {
@@ -21,10 +23,10 @@ type ProjectManager struct {
 	config runtimeInterfaces.Configuration
 }
 
-var alphabeticalSortParam, _ = common.NewSortParameter(admin.Sort{
+var alphabeticalSortParam, _ = common.NewSortParameter(&admin.Sort{
 	Direction: admin.Sort_ASCENDING,
 	Key:       "identifier",
-})
+}, models.ProjectColumns)
 
 func (m *ProjectManager) CreateProject(ctx context.Context, request admin.ProjectRegisterRequest) (
 	*admin.ProjectRegisterResponse, error) {
@@ -61,13 +63,11 @@ func (m *ProjectManager) ListProjects(ctx context.Context, request admin.Project
 		return nil, err
 	}
 
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
-	} else {
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.ProjectColumns)
+	if err != nil {
+		return nil, err
+	}
+	if sortParameter == nil {
 		sortParameter = alphabeticalSortParam
 	}
 

programming_language: Go
filename: signal_manager.go
change_type: ModificationType.MODIFY
diff: @@ -4,7 +4,13 @@ import (
 	"context"
 	"strconv"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/contextutils"
+	"github.com/flyteorg/flytestdlib/logger"
+	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/promutils/labeled"
+	"google.golang.org/grpc/codes"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
@@ -12,16 +18,8 @@ import (
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
-
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
-	"github.com/flyteorg/flytestdlib/logger"
-	"github.com/flyteorg/flytestdlib/promutils"
-	"github.com/flyteorg/flytestdlib/promutils/labeled"
-
-	"google.golang.org/grpc/codes"
 )
 
 type signalMetrics struct {
@@ -83,12 +81,10 @@ func (s *SignalManager) ListSignals(ctx context.Context, request admin.SignalLis
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.SignalColumns)
+	if err != nil {
+		return nil, err
 	}
 
 	offset, err := validation.ValidateToken(request.Token)

programming_language: Go
filename: task_execution_manager.go
change_type: ModificationType.MODIFY
diff: @@ -5,20 +5,19 @@ import (
 	"fmt"
 	"strconv"
 
-	cloudeventInterfaces "github.com/flyteorg/flyteadmin/pkg/async/cloudevent/interfaces"
-
-	"github.com/flyteorg/flytestdlib/promutils/labeled"
-
-	notificationInterfaces "github.com/flyteorg/flyteadmin/pkg/async/notifications/interfaces"
-	"github.com/golang/protobuf/proto"
-
-	"github.com/flyteorg/flytestdlib/storage"
-
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/contextutils"
-
+	"github.com/flyteorg/flytestdlib/logger"
 	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/promutils/labeled"
+	"github.com/flyteorg/flytestdlib/storage"
+	"github.com/golang/protobuf/proto"
 	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
+	cloudeventInterfaces "github.com/flyteorg/flyteadmin/pkg/async/cloudevent/interfaces"
+	notificationInterfaces "github.com/flyteorg/flyteadmin/pkg/async/notifications/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	dataInterfaces "github.com/flyteorg/flyteadmin/pkg/data/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
@@ -29,10 +28,6 @@ import (
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"github.com/flyteorg/flytestdlib/logger"
-	"google.golang.org/grpc/codes"
 )
 
 type taskExecutionMetrics struct {
@@ -258,12 +253,10 @@ func (m *TaskExecutionManager) ListTaskExecutions(
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.TaskExecutionColumns)
+	if err != nil {
+		return nil, err
 	}
 
 	offset, err := validation.ValidateToken(request.Token)

programming_language: Go
filename: task_manager.go
change_type: ModificationType.MODIFY
diff: @@ -6,17 +6,15 @@ import (
 	"strconv"
 	"time"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/contextutils"
-
-	"github.com/prometheus/client_golang/prometheus"
-
+	"github.com/flyteorg/flytestdlib/logger"
 	"github.com/flyteorg/flytestdlib/promutils"
 	"github.com/flyteorg/flytestdlib/promutils/labeled"
-
 	"github.com/golang/protobuf/ptypes"
-
-	"github.com/flyteorg/flytestdlib/logger"
+	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
@@ -25,11 +23,10 @@ import (
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/validation"
 	"github.com/flyteorg/flyteadmin/pkg/manager/interfaces"
 	repoInterfaces "github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/transformers"
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
 	workflowengine "github.com/flyteorg/flyteadmin/pkg/workflowengine/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"google.golang.org/grpc/codes"
 )
 
 type taskMetrics struct {
@@ -169,13 +166,12 @@ func (t *TaskManager) ListTasks(ctx context.Context, request admin.ResourceListR
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.TaskColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,
@@ -226,13 +222,12 @@ func (t *TaskManager) ListUniqueTaskIdentifiers(ctx context.Context, request adm
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.TaskColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,

programming_language: Go
filename: filters.go
change_type: ModificationType.MODIFY
diff: @@ -3,6 +3,7 @@ package util
 
 import (
 	"context"
+	"fmt"
 	"regexp"
 	"strconv"
 	"strings"
@@ -10,14 +11,13 @@ import (
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/logger"
-
-	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"google.golang.org/grpc/codes"
-
-	"fmt"
+	"k8s.io/apimachinery/pkg/util/sets"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
+	"github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 )
 
 const (
@@ -120,6 +120,36 @@ func prepareValues(field string, values []string) (interface{}, error) {
 	return preparedValues, nil
 }
 
+var allowedJoinEntities = map[common.Entity]sets.String{
+	common.Execution:           sets.NewString(common.Execution, common.LaunchPlan, common.Workflow, common.Task, common.AdminTag),
+	common.LaunchPlan:          sets.NewString(common.LaunchPlan, common.Workflow),
+	common.NodeExecution:       sets.NewString(common.NodeExecution, common.Execution),
+	common.NodeExecutionEvent:  sets.NewString(common.NodeExecutionEvent),
+	common.Task:                sets.NewString(common.Task),
+	common.TaskExecution:       sets.NewString(common.TaskExecution, common.Task, common.Execution, common.NodeExecution),
+	common.Workflow:            sets.NewString(common.Workflow),
+	common.NamedEntity:         sets.NewString(common.NamedEntity),
+	common.NamedEntityMetadata: sets.NewString(common.NamedEntityMetadata),
+	common.Project:             sets.NewString(common.Project),
+	common.Signal:              sets.NewString(common.Signal),
+	common.AdminTag:            sets.NewString(common.AdminTag),
+}
+
+var entityColumns = map[common.Entity]sets.String{
+	common.Execution:           models.ExecutionColumns,
+	common.LaunchPlan:          models.LaunchPlanColumns,
+	common.NodeExecution:       models.NodeExecutionColumns,
+	common.NodeExecutionEvent:  models.NodeExecutionEventColumns,
+	common.Task:                models.TaskColumns,
+	common.TaskExecution:       models.TaskExecutionColumns,
+	common.Workflow:            models.WorkflowColumns,
+	common.NamedEntity:         models.NamedEntityColumns,
+	common.NamedEntityMetadata: models.NamedEntityMetadataColumns,
+	common.Project:             models.ProjectColumns,
+	common.Signal:              models.SignalColumns,
+	common.AdminTag:            models.AdminTagColumns,
+}
+
 func ParseFilters(filterParams string, primaryEntity common.Entity) ([]common.InlineFilter, error) {
 	// Multiple filters can be appended as URI-escaped strings joined by filterExpressionSeperator
 	filterExpressions := strings.Split(filterParams, filterExpressionSeperator)
@@ -133,6 +163,19 @@ func ParseFilters(filterParams string, primaryEntity common.Entity) ([]common.In
 		}
 		referencedEntity, field := parseField(matches[fieldMatchIndex], primaryEntity)
 
+		joinEntities, ok := allowedJoinEntities[primaryEntity]
+		if !ok {
+			return nil, fmt.Errorf("unsupported entity '%s'", primaryEntity)
+		}
+
+		if !joinEntities.Has(referencedEntity) {
+			return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "'%s' entity is not allowed in filters", referencedEntity)
+		}
+
+		if !entityColumns[referencedEntity].Has(field) {
+			return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "'%s.%s' is invalid filter", referencedEntity, field)
+		}
+
 		// Parse and transform values
 		parsedValues := parseRepeatedValues(matches[valueMatchIndex])
 		preparedValues, err := prepareValues(field, parsedValues)

programming_language: Go
filename: filters_test.go
change_type: ModificationType.MODIFY
diff: @@ -6,11 +6,12 @@ import (
 	"time"
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
 	"github.com/flyteorg/flyteadmin/pkg/manager/impl/testutils"
-	"github.com/stretchr/testify/assert"
 )
 
 func TestParseRepeatedValues(t *testing.T) {
@@ -64,30 +65,59 @@ func TestPrepareValues_RepeatedValues(t *testing.T) {
 	assert.Equal(t, []interface{}{"value a", "value b"}, values)
 }
 
-func TestParseFilters(t *testing.T) {
-	filterExpression := "eq(foo, 123)+ne(version, TheWorst)+value_in(bar, 4;5;6)"
+func Test_ParseFilters_Success(t *testing.T) {
+	filterExpression := "eq(project, flytesnacks)+ne(domain, development)+value_in(type, 4;5;6)"
+
 	taskFilters, err := ParseFilters(filterExpression, common.Task)
+
 	assert.NoError(t, err)
+	require.Len(t, taskFilters, 3)
 
-	assert.Len(t, taskFilters, 3)
 	actualFilterExpression, _ := taskFilters[0].GetGormQueryExpr()
-	assert.Equal(t, "foo = ?", actualFilterExpression.Query)
-	assert.Equal(t, "123", actualFilterExpression.Args)
+	assert.Equal(t, "project = ?", actualFilterExpression.Query)
+	assert.Equal(t, "flytesnacks", actualFilterExpression.Args)
 
 	actualFilterExpression, _ = taskFilters[1].GetGormQueryExpr()
-	assert.Equal(t, "version <> ?", actualFilterExpression.Query)
-	assert.Equal(t, "TheWorst", actualFilterExpression.Args)
+	assert.Equal(t, "domain <> ?", actualFilterExpression.Query)
+	assert.Equal(t, "development", actualFilterExpression.Args)
 
 	actualFilterExpression, _ = taskFilters[2].GetGormQueryExpr()
-	assert.Equal(t, "bar in (?)", actualFilterExpression.Query)
+	assert.Equal(t, "type in (?)", actualFilterExpression.Query)
 	assert.Equal(t, []interface{}{"4", "5", "6"}, actualFilterExpression.Args)
+}
+
+func Test_ParseFilters_InvalidFunction(t *testing.T) {
+	filterExpression := "invalid_function(type,bar)"
+
+	_, err := ParseFilters(filterExpression, common.Task)
 
-	filterExpression = "invalid_function(foo,bar)"
-	_, err = ParseFilters(filterExpression, common.Task)
-	assert.Error(t, err)
 	assert.EqualError(t, err, "unrecognized filter function: invalid_function")
 }
 
+func Test_ParseFilters_UnsupportedEntity(t *testing.T) {
+	filterExpression := "eq(foo, 123)"
+
+	_, err := ParseFilters(filterExpression, "wrong")
+
+	assert.EqualError(t, err, "unsupported entity 'wrong'")
+}
+
+func Test_ParseFilters_InvalidJoinEntity(t *testing.T) {
+	filterExpression := "eq(project.name, 123)"
+
+	_, err := ParseFilters(filterExpression, common.Workflow)
+
+	assert.EqualError(t, err, "'p' entity is not allowed in filters")
+}
+
+func Test_ParseFilters_InvalidFilter(t *testing.T) {
+	filterExpression := "eq(foo, 123)"
+
+	_, err := ParseFilters(filterExpression, common.Task)
+
+	assert.EqualError(t, err, "'t.foo' is invalid filter")
+}
+
 func TestGetEqualityFilter(t *testing.T) {
 	filter, err := GetSingleValueEqualityFilter(common.Task, "field", "value")
 	assert.NoError(t, err)
@@ -97,18 +127,20 @@ func TestGetEqualityFilter(t *testing.T) {
 	assert.Equal(t, "value", actualFilterExpression.Args)
 }
 
-func TestAddRequestFilters(t *testing.T) {
+func Test_AddRequestFilters(t *testing.T) {
 	filters, err := AddRequestFilters(
-		"ne(version, TheWorst)+eq(workflow.name, workflow)", common.Execution, make([]common.InlineFilter, 0))
-	assert.Nil(t, err)
-	assert.Len(t, filters, 2)
+		"ne(cluster, TheWorst)+eq(workflow.name, workflow)", common.Execution, make([]common.InlineFilter, 0))
+
+	assert.NoError(t, err)
+	require.Len(t, filters, 2)
+
 	expression, err := filters[0].GetGormQueryExpr()
-	assert.Nil(t, err)
-	assert.Equal(t, "version <> ?", expression.Query)
+	assert.NoError(t, err)
+	assert.Equal(t, "cluster <> ?", expression.Query)
 	assert.Equal(t, "TheWorst", expression.Args)
 
 	expression, err = filters[1].GetGormQueryExpr()
-	assert.Nil(t, err)
+	assert.NoError(t, err)
 	assert.Equal(t, testutils.NameQueryPattern, expression.Query)
 	assert.Equal(t, "workflow", expression.Args)
 }

programming_language: Go
filename: workflow_manager.go
change_type: ModificationType.MODIFY
diff: @@ -6,7 +6,16 @@ import (
 	"strconv"
 	"time"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	compiler "github.com/flyteorg/flytepropeller/pkg/compiler/common"
 	"github.com/flyteorg/flytestdlib/contextutils"
+	"github.com/flyteorg/flytestdlib/logger"
+	"github.com/flyteorg/flytestdlib/promutils"
+	"github.com/flyteorg/flytestdlib/storage"
+	"github.com/golang/protobuf/ptypes"
+	"github.com/prometheus/client_golang/prometheus"
+	"google.golang.org/grpc/codes"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/errors"
@@ -19,15 +28,6 @@ import (
 	runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
 	workflowengine "github.com/flyteorg/flyteadmin/pkg/workflowengine/impl"
 	workflowengineInterfaces "github.com/flyteorg/flyteadmin/pkg/workflowengine/interfaces"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	compiler "github.com/flyteorg/flytepropeller/pkg/compiler/common"
-	"github.com/flyteorg/flytestdlib/logger"
-	"github.com/flyteorg/flytestdlib/promutils"
-	"github.com/flyteorg/flytestdlib/storage"
-	"github.com/golang/protobuf/ptypes"
-	"github.com/prometheus/client_golang/prometheus"
-	"google.golang.org/grpc/codes"
 )
 
 var defaultStorageOptions = storage.Options{}
@@ -252,13 +252,12 @@ func (w *WorkflowManager) ListWorkflows(
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.WorkflowColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,
@@ -306,13 +305,12 @@ func (w *WorkflowManager) ListWorkflowIdentifiers(ctx context.Context, request a
 	if err != nil {
 		return nil, err
 	}
-	var sortParameter common.SortParameter
-	if request.SortBy != nil {
-		sortParameter, err = common.NewSortParameter(*request.SortBy)
-		if err != nil {
-			return nil, err
-		}
+
+	sortParameter, err := common.NewSortParameter(request.SortBy, models.WorkflowColumns)
+	if err != nil {
+		return nil, err
 	}
+
 	offset, err := validation.ValidateToken(request.Token)
 	if err != nil {
 		return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,

programming_language: Go
filename: common.go
change_type: ModificationType.MODIFY
diff: @@ -2,14 +2,17 @@ package gormimpl
 
 import (
 	"fmt"
+	"sync"
+
+	"google.golang.org/grpc/codes"
+	"gorm.io/gorm"
+	"gorm.io/gorm/schema"
+	"k8s.io/apimachinery/pkg/util/sets"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	adminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
-
-	"google.golang.org/grpc/codes"
-	"gorm.io/gorm"
 )
 
 const Project = "project"
@@ -115,3 +118,11 @@ func applyScopedFilters(tx *gorm.DB, inlineFilters []common.InlineFilter, mapFil
 	}
 	return tx, nil
 }
+
+func modelColumns(v any) sets.String {
+	s, err := schema.Parse(v, &sync.Map{}, schema.NamingStrategy{})
+	if err != nil {
+		panic(err)
+	}
+	return sets.NewString(s.DBNames...)
+}

programming_language: Go
filename: description_entity_repo.go
change_type: ModificationType.MODIFY
diff: @@ -3,14 +3,14 @@ package gormimpl
 import (
 	"context"
 
-	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/promutils"
+	"gorm.io/gorm"
 
+	"github.com/flyteorg/flyteadmin/pkg/common"
 	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"gorm.io/gorm"
 )
 
 // DescriptionEntityRepo Implementation of DescriptionEntityRepoInterface.

programming_language: Go
filename: execution_repo.go
change_type: ModificationType.MODIFY
diff: @@ -5,12 +5,13 @@ import (
 	"errors"
 	"fmt"
 
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	"github.com/flyteorg/flytestdlib/promutils"
+
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	adminErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"github.com/flyteorg/flytestdlib/promutils"
 
 	"gorm.io/gorm"
 )

programming_language: Go
filename: execution_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -6,18 +6,17 @@ import (
 	"testing"
 	"time"
 
+	mocket "github.com/Selvatico/go-mocket"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
 	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-
-	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/stretchr/testify/assert"
 )
 
 var createdAt = time.Date(2018, time.February, 17, 00, 00, 00, 00, time.UTC).UTC()
@@ -250,14 +249,16 @@ func TestListExecutions_Order(t *testing.T) {
 	executions := make([]map[string]interface{}, 0)
 	GlobalMock := mocket.Catcher.Reset()
 	// Only match on queries that include ordering by name
-	mockQuery := GlobalMock.NewMock().WithQuery(`name asc`)
+	mockQuery := GlobalMock.NewMock().WithQuery(`execution_name asc`)
 	mockQuery.WithReply(executions)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, err := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_ASCENDING,
-		Key:       "name",
-	})
-	_, err := executionRepo.List(context.Background(), interfaces.ListResourceInput{
+		Key:       "execution_name",
+	}, models.ExecutionColumns)
+	require.NoError(t, err)
+
+	_, err = executionRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{
 			getEqualityFilter(common.Task, "project", project),
@@ -266,6 +267,7 @@ func TestListExecutions_Order(t *testing.T) {
 		},
 		Limit: 20,
 	})
+
 	assert.NoError(t, err)
 	assert.True(t, mockQuery.Triggered)
 }
@@ -276,16 +278,19 @@ func TestListExecutions_WithTags(t *testing.T) {
 	executions := make([]map[string]interface{}, 0)
 	GlobalMock := mocket.Catcher.Reset()
 	// Only match on queries that include ordering by name
-	mockQuery := GlobalMock.NewMock().WithQuery(`name asc`)
+	mockQuery := GlobalMock.NewMock().WithQuery(`execution_name asc`)
 	mockQuery.WithReply(executions)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, err := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_ASCENDING,
-		Key:       "name",
-	})
+		Key:       "execution_name",
+	}, models.ExecutionColumns)
+	require.NoError(t, err)
+
 	vals := []string{"tag1", "tag2"}
 	tagFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "admin_tag_name", vals)
 	assert.NoError(t, err)
+
 	_, err = executionRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{

programming_language: Go
filename: launch_plan_repo.go
change_type: ModificationType.MODIFY
diff: @@ -8,11 +8,12 @@ import (
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/promutils"
 
+	"github.com/flyteorg/flytestdlib/logger"
+	"gorm.io/gorm"
+
 	adminErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flytestdlib/logger"
-	"gorm.io/gorm"
 )
 
 const launchPlanTableName = "launch_plans"

programming_language: Go
filename: launch_plan_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -5,15 +5,15 @@ import (
 	"database/sql/driver"
 	"testing"
 
+	mocket "github.com/Selvatico/go-mocket"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
 
-	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	"github.com/stretchr/testify/assert"
 )
 
 const workflowID = uint(1)
@@ -345,10 +345,10 @@ func TestListLaunchPlans_Order(t *testing.T) {
 	mockQuery.WithQuery(`project desc`)
 	mockQuery.WithReply(launchPlans)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, _ := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
 		Key:       "project",
-	})
+	}, models.LaunchPlanColumns)
 	_, err := launchPlanRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{

programming_language: Go
filename: named_entity_repo.go
change_type: ModificationType.MODIFY
diff: @@ -5,15 +5,15 @@ import (
 	"fmt"
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	"github.com/flyteorg/flytestdlib/promutils"
 	"google.golang.org/grpc/codes"
+	"gorm.io/gorm"
 
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	adminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flytestdlib/promutils"
-	"gorm.io/gorm"
 )
 
 const innerJoinTableAlias = "entities"

programming_language: Go
filename: named_entity_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -9,11 +9,12 @@ import (
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 
 	mocket "github.com/Selvatico/go-mocket"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
+
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-	"github.com/stretchr/testify/assert"
 )
 
 func getMockNamedEntityResponseFromDb(expected models.NamedEntity) map[string]interface{} {
@@ -157,10 +158,10 @@ func TestListNamedEntity(t *testing.T) {
 	mockQuery.WithQuery(
 		`SELECT entities.project,entities.domain,entities.name,'2' AS resource_type,named_entity_metadata.description,named_entity_metadata.state FROM "named_entity_metadata" RIGHT JOIN (SELECT project,domain,name FROM "workflows" WHERE "domain" = $1 AND "project" = $2 GROUP BY project, domain, name ORDER BY name desc LIMIT 20) AS entities ON named_entity_metadata.resource_type = 2 AND named_entity_metadata.project = entities.project AND named_entity_metadata.domain = entities.domain AND named_entity_metadata.name = entities.name GROUP BY entities.project, entities.domain, entities.name, named_entity_metadata.description, named_entity_metadata.state ORDER BY name desc`).WithReply(results)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, _ := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
 		Key:       "name",
-	})
+	}, models.NamedEntityColumns)
 	output, err := metadataRepo.List(context.Background(), interfaces.ListNamedEntityInput{
 		ResourceType: resourceType,
 		Project:      "admintests",

programming_language: Go
filename: node_execution_event_repo.go
change_type: ModificationType.MODIFY
diff: @@ -3,11 +3,12 @@ package gormimpl
 import (
 	"context"
 
+	"github.com/flyteorg/flytestdlib/promutils"
+	"gorm.io/gorm"
+
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flytestdlib/promutils"
-	"gorm.io/gorm"
 )
 
 type NodeExecutionEventRepo struct {

programming_language: Go
filename: node_execution_repo.go
change_type: ModificationType.MODIFY
diff: @@ -6,13 +6,12 @@ import (
 	"fmt"
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
 	"github.com/flyteorg/flytestdlib/promutils"
+	"gorm.io/gorm"
 
 	adminErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"gorm.io/gorm"
 )
 
 // Implementation of NodeExecutionInterface.

programming_language: Go
filename: node_execution_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -5,21 +5,20 @@ import (
 	"testing"
 	"time"
 
-	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
-	"google.golang.org/grpc/codes"
-	"gorm.io/gorm"
-
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-
+	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+	"google.golang.org/grpc/codes"
+	"gorm.io/gorm"
 
-	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteadmin/pkg/common"
+	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/stretchr/testify/assert"
 )
 
 var nodePhase = core.NodeExecution_RUNNING.String()
@@ -248,20 +247,23 @@ func TestListNodeExecutions_Order(t *testing.T) {
 	GlobalMock := mocket.Catcher.Reset()
 	// Only match on queries that include ordering by project
 	mockQuery := GlobalMock.NewMock()
-	mockQuery.WithQuery(`project desc`)
+	mockQuery.WithQuery(`execution_project desc`)
 	mockQuery.WithReply(nodeExecutions)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, err := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
-		Key:       "project",
-	})
-	_, err := nodeExecutionRepo.List(context.Background(), interfaces.ListResourceInput{
+		Key:       "execution_project",
+	}, models.NodeExecutionColumns)
+	require.NoError(t, err)
+
+	_, err = nodeExecutionRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{
 			getEqualityFilter(common.NodeExecution, "phase", nodePhase),
 		},
 		Limit: 20,
 	})
+
 	assert.NoError(t, err)
 	assert.True(t, mockQuery.Triggered)
 }

programming_language: Go
filename: project_repo.go
change_type: ModificationType.MODIFY
diff: @@ -4,14 +4,12 @@ import (
 	"context"
 	"errors"
 
-	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
-	"google.golang.org/grpc/codes"
-
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 	"github.com/flyteorg/flytestdlib/promutils"
-
+	"google.golang.org/grpc/codes"
 	"gorm.io/gorm"
 
+	flyteAdminErrors "github.com/flyteorg/flyteadmin/pkg/errors"
 	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"

programming_language: Go
filename: project_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -5,19 +5,20 @@ import (
 	"testing"
 
 	mocket "github.com/Selvatico/go-mocket"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
+
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-	"github.com/stretchr/testify/assert"
 )
 
-var alphabeticalSortParam, _ = common.NewSortParameter(admin.Sort{
+var alphabeticalSortParam, _ = common.NewSortParameter(&admin.Sort{
 	Direction: admin.Sort_ASCENDING,
 	Key:       "identifier",
-})
+}, models.ProjectColumns)
 
 func TestCreateProject(t *testing.T) {
 	projectRepo := NewProjectRepo(GetDbForTest(t), errors.NewTestErrorTransformer(), mockScope.NewTestScope())
@@ -94,7 +95,8 @@ func testListProjects(input interfaces.ListResourceInput, sql string, t *testing
 
 func TestListProjects(t *testing.T) {
 	filter, err := common.NewSingleValueFilter(common.Project, common.Equal, "name", "foo")
-	assert.Nil(t, err)
+
+	assert.NoError(t, err)
 	testListProjects(interfaces.ListResourceInput{
 		Offset:        0,
 		Limit:         1,

programming_language: Go
filename: resource_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -4,15 +4,14 @@ import (
 	"context"
 	"testing"
 
+	mocket "github.com/Selvatico/go-mocket"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
 	"gorm.io/gorm"
 
-	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
-
-	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-	"github.com/stretchr/testify/assert"
 )
 
 const resourceTestWorkflowName = "workflow"

programming_language: Go
filename: signal_repo.go
change_type: ModificationType.MODIFY
diff: @@ -4,16 +4,14 @@ import (
 	"context"
 	"errors"
 
+	"github.com/flyteorg/flytestdlib/promutils"
+	"google.golang.org/grpc/codes"
+	"gorm.io/gorm"
+
 	adminerrors "github.com/flyteorg/flyteadmin/pkg/errors"
 	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-
-	"github.com/flyteorg/flytestdlib/promutils"
-
-	"google.golang.org/grpc/codes"
-
-	"gorm.io/gorm"
 )
 
 // SignalRepo is an implementation of SignalRepoInterface.

programming_language: Go
filename: task_execution_repo.go
change_type: ModificationType.MODIFY
diff: @@ -5,13 +5,12 @@ import (
 	"errors"
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
 	"github.com/flyteorg/flytestdlib/promutils"
+	"gorm.io/gorm"
 
 	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"gorm.io/gorm"
 )
 
 // Implementation of TaskExecutionInterface.

programming_language: Go
filename: task_execution_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -5,15 +5,15 @@ import (
 	"testing"
 	"time"
 
+	mocket "github.com/Selvatico/go-mocket"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
 
-	mocket "github.com/Selvatico/go-mocket"
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-	"github.com/stretchr/testify/assert"
 )
 
 var taskPhase = core.TaskExecution_ABORTED.String()

programming_language: Go
filename: task_repo.go
change_type: ModificationType.MODIFY
diff: @@ -5,13 +5,12 @@ import (
 	"errors"
 
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
-
 	"github.com/flyteorg/flytestdlib/promutils"
+	"gorm.io/gorm"
 
 	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"gorm.io/gorm"
 )
 
 // Implementation of TaskRepoInterface.

programming_language: Go
filename: task_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -9,11 +9,12 @@ import (
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
 
 	mocket "github.com/Selvatico/go-mocket"
+	"github.com/stretchr/testify/assert"
+
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/stretchr/testify/assert"
 )
 
 const pythonTestTaskType = "python-task"
@@ -197,10 +198,10 @@ func TestListTasks_Order(t *testing.T) {
 	mockQuery.WithQuery(`project desc`)
 	mockQuery.WithReply(tasks)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, _ := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
 		Key:       "project",
-	})
+	}, models.TaskColumns)
 	_, err := taskRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{

programming_language: Go
filename: workflow_repo.go
change_type: ModificationType.MODIFY
diff: @@ -4,12 +4,13 @@ import (
 	"context"
 	"errors"
 
-	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
-	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
-	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
 	"github.com/flyteorg/flytestdlib/promutils"
 	"gorm.io/gorm"
+
+	flyteAdminDbErrors "github.com/flyteorg/flyteadmin/pkg/repositories/errors"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
+	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
 )
 
 // Implementation of WorkflowRepoInterface.

programming_language: Go
filename: workflow_repo_test.go
change_type: ModificationType.MODIFY
diff: @@ -5,13 +5,14 @@ import (
 	"testing"
 
 	mocket "github.com/Selvatico/go-mocket"
+	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
+	mockScope "github.com/flyteorg/flytestdlib/promutils"
+	"github.com/stretchr/testify/assert"
+
 	"github.com/flyteorg/flyteadmin/pkg/common"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/errors"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/interfaces"
 	"github.com/flyteorg/flyteadmin/pkg/repositories/models"
-	"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
-	mockScope "github.com/flyteorg/flytestdlib/promutils"
-	"github.com/stretchr/testify/assert"
 )
 
 var typedInterface = []byte{1, 2, 3}
@@ -182,10 +183,10 @@ func TestListWorkflows_Order(t *testing.T) {
 	mockQuery.WithQuery(`project desc`)
 	mockQuery.WithReply(workflows)
 
-	sortParameter, _ := common.NewSortParameter(admin.Sort{
+	sortParameter, _ := common.NewSortParameter(&admin.Sort{
 		Direction: admin.Sort_DESCENDING,
 		Key:       "project",
-	})
+	}, models.WorkflowColumns)
 	_, err := workflowRepo.List(context.Background(), interfaces.ListResourceInput{
 		SortParameter: sortParameter,
 		InlineFilters: []common.InlineFilter{

programming_language: Go
filename: base_model.go
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,12 @@
 package models
 
-import "time"
+import (
+	"sync"
+	"time"
+
+	"gorm.io/gorm/schema"
+	"k8s.io/apimachinery/pkg/util/sets"
+)
 
 // This is the base model definition every flyteadmin model embeds.
 // This is nearly identical to http://doc.gorm.io/models.html#conventions except that flyteadmin models define their
@@ -11,3 +17,11 @@ type BaseModel struct {
 	UpdatedAt time.Time
 	DeletedAt *time.Time `gorm:"index"`
 }
+
+func modelColumns(v any) sets.String {
+	s, err := schema.Parse(v, &sync.Map{}, schema.NamingStrategy{})
+	if err != nil {
+		panic(err)
+	}
+	return sets.NewString(s.DBNames...)
+}

programming_language: Go
filename: description_entity.go
change_type: ModificationType.MODIFY
diff: @@ -28,3 +28,5 @@ type DescriptionEntity struct {
 
 	SourceCode
 }
+
+var DescriptionEntityColumns = modelColumns(DescriptionEntity{})

programming_language: Go
filename: execution.go
change_type: ModificationType.MODIFY
diff: @@ -80,3 +80,8 @@ func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) {
 	})
 	return nil
 }
+
+var (
+	ExecutionColumns = modelColumns(Execution{})
+	AdminTagColumns  = modelColumns(AdminTag{})
+)

programming_language: Go
filename: launch_plan.go
change_type: ModificationType.MODIFY
diff: @@ -32,3 +32,5 @@ type LaunchPlan struct {
 	Digest       []byte
 	ScheduleType LaunchPlanScheduleType
 }
+
+var LaunchPlanColumns = modelColumns(LaunchPlan{})

programming_language: Go
filename: named_entity.go
change_type: ModificationType.MODIFY
diff: @@ -40,3 +40,8 @@ type NamedEntity struct {
 	NamedEntityKey
 	NamedEntityMetadataFields
 }
+
+var (
+	NamedEntityColumns         = modelColumns(NamedEntity{})
+	NamedEntityMetadataColumns = modelColumns(NamedEntityMetadata{})
+)

programming_language: Go
filename: node_execution.go
change_type: ModificationType.MODIFY
diff: @@ -51,3 +51,5 @@ type NodeExecution struct {
 	// Metadata that is only relevant to the flyteadmin service that is used to parse the model and track additional attributes.
 	InternalData []byte
 }
+
+var NodeExecutionColumns = modelColumns(NodeExecution{})

programming_language: Go
filename: node_execution_event.go
change_type: ModificationType.MODIFY
diff: @@ -11,3 +11,5 @@ type NodeExecutionEvent struct {
 	OccurredAt time.Time
 	Phase      string `gorm:"primary_key"`
 }
+
+var NodeExecutionEventColumns = modelColumns(NodeExecutionEvent{})

programming_language: Go
filename: project.go
change_type: ModificationType.MODIFY
diff: @@ -9,3 +9,5 @@ type Project struct {
 	// GORM doesn't save the zero value for ints, so we use a pointer for the State field
 	State *int32 `gorm:"default:0;index"`
 }
+
+var ProjectColumns = modelColumns(Project{})

programming_language: Go
filename: signal.go
change_type: ModificationType.MODIFY
diff: @@ -13,3 +13,5 @@ type Signal struct {
 	Type  []byte `gorm:"not null"`
 	Value []byte
 }
+
+var SignalColumns = modelColumns(Signal{})

programming_language: Go
filename: task.go
change_type: ModificationType.MODIFY
diff: @@ -23,3 +23,5 @@ type Task struct {
 	// ShortDescription for the task.
 	ShortDescription string
 }
+
+var TaskColumns = modelColumns(Task{})

programming_language: Go
filename: task_execution.go
change_type: ModificationType.MODIFY
diff: @@ -37,3 +37,5 @@ type TaskExecution struct {
 	// The child node executions (if any) launched by this task execution.
 	ChildNodeExecution []NodeExecution `gorm:"foreignkey:ParentTaskExecutionID;references:ID"`
 }
+
+var TaskExecutionColumns = modelColumns(TaskExecution{})

programming_language: Go
filename: workflow.go
change_type: ModificationType.MODIFY
diff: @@ -19,3 +19,5 @@ type Workflow struct {
 	// ShortDescription for the workflow.
 	ShortDescription string
 }
+
+var WorkflowColumns = modelColumns(Workflow{})

programming_language: Go