neos-development-collection
neos-development-collection copied to clipboard
It's possible to create workspaces with invalid names
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
./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..- switch to the new workspace in the backend
- 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:
- validate the constructor parameter $name and throw an exception if it doesn't match
- 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
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.