Return NOT_FOUND for invalid workflow ID
@@ -30,6 +30,7 @@ import (
"context"
"sync/atomic"
"time"
+ "unicode/utf8"
"github.com/pborman/uuid"
commonpb "go.temporal.io/api/common/v1"
@@ -234,6 +235,11 @@ func (c *CacheImpl) validateWorkflowExecutionInfo(
return serviceerror.NewInvalidArgument("Can't load workflow execution. WorkflowId not set.")
}
+ if !utf8.ValidString(execution.GetWorkflowId()) {
+ // We know workflow cannot exist with invalid utf8 string as WorkflowID.
+ return serviceerror.NewNotFound("Workflow not exists.")
+ }
+
// RunID is not provided, lets try to retrieve the RunID for current active execution
if execution.GetRunId() == "" {
response, err := c.getCurrentExecutionWithRetry(&persistence.GetCurrentExecutionRequest{
