diff --git a/service/frontend/workflow_handler.go b/service/frontend/workflow_handler.go index 3ba35c167d9..f96048e44b1 100644 --- a/service/frontend/workflow_handler.go +++ b/service/frontend/workflow_handler.go @@ -4314,6 +4314,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 091317d6636..42330f64ad5 100644 --- a/service/frontend/workflow_handler_test.go +++ b/service/frontend/workflow_handler_test.go @@ -2955,3 +2955,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: "valid-tq-name", NormalName: "\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") +}