diff --git a/service/frontend/workflow_handler.go b/service/frontend/workflow_handler.go index 1bf9c1b70a5..cae768c2dbd 100644 --- a/service/frontend/workflow_handler.go +++ b/service/frontend/workflow_handler.go @@ -4318,6 +4318,11 @@ func (wh *WorkflowHandler) validateTaskQueue(t *taskqueuepb.TaskQueue) error { if err := common.ValidateUTF8String("TaskQueue", t.GetName()); err != nil { return err } + if t.GetKind() == enumspb.TASK_QUEUE_KIND_STICKY { + if err := common.ValidateUTF8String("TaskQueue", t.GetNormalName()); err != nil { + return err + } + } enums.SetDefaultTaskQueueKind(&t.Kind) return nil diff --git a/service/frontend/workflow_handler_test.go b/service/frontend/workflow_handler_test.go index c413230fa6f..75cb2c138d9 100644 --- a/service/frontend/workflow_handler_test.go +++ b/service/frontend/workflow_handler_test.go @@ -2977,3 +2977,21 @@ func (s *workflowHandlerSuite) Test_DeleteWorkflowExecution() { s.NoError(err) s.NotNil(resp) } + +func (s *workflowHandlerSuite) Test_ValidateTaskQueue() { + wh := s.getWorkflowHandler(s.newConfig()) + + tq := taskqueuepb.TaskQueue{Name: "\x87\x01"} + err := wh.validateTaskQueue(&tq) + s.Error(err) + s.Contains(err.Error(), "is not a valid UTF-8 string") + + tq = taskqueuepb.TaskQueue{Name: "valid-tq-name"} + err = wh.validateTaskQueue(&tq) + s.NoError(err) + + tq = taskqueuepb.TaskQueue{Name: "\x87\x01", Kind: enumspb.TASK_QUEUE_KIND_STICKY} + err = wh.validateTaskQueue(&tq) + s.Error(err) + s.Contains(err.Error(), "is not a valid UTF-8 string") +}