neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

It's possible to create workspaces with invalid names

Open Kleisli opened this issue 4 years ago • 1 comments

Description

According to NodeInterface::MATCH_PATTERN_CONTEXTPATH a valid format for namespaces is [a-z0-9\-]+ While this is ensured in the createAction of Neos\Neos\Controller\Module\Management\WorkspaceController you can create invalid workspaces (throwing an error in the backend) when using the command controller or creating a workspace by new Workspace()

Steps to Reproduce

  1. ./flow workspace:create Test_ --description 'this will generate an error in the backend' a) btw. the default value of $description in the commandController is null, but setDescription() does only accept strings..
  2. switch to the new workspace in the backend
  3. An exception was thrown while Neos tried to render your page The given string was not a valid contextPath. thrown in Neos\ContentRepository\Domain\Utility\NodePaths line 75, because the workspace name doesn't match the pattern

Expected behavior

I'm not sure about that... there I see 2 options:

  1. validate the constructor parameter $name and throw an exception if it doesn't match
  2. change the constructor of Workspace to take $title instead of $name and generate the name the same way it is currently done in the createAction of the WorkspaceController, using Utility::renderValidNodeName($title) . '-' . ...

Affected Versions

Neos: 7.2 Flow: 7.2

Kleisli avatar Nov 13 '21 23:11 Kleisli

As were currently working on workspacy things do we want to fix this for 8.4 or close this as wont fix? With 9.0 this will be fixed.

mhsdesign avatar Jun 14 '24 11:06 mhsdesign