Skip to content

Commit 9ff60fc

Browse files
committed
BUGFIX: Find nodes in CR without security checks to allow nodes of other workspaces
1 parent fdf4763 commit 9ff60fc

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

Classes/Indexer/NodeIndexer.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
4242
use Neos\Flow\Annotations as Flow;
4343
use Neos\Flow\Log\Utility\LogEnvironment;
44+
use Neos\Flow\Security\Context;
4445
use Neos\Utility\Exception\FilesException;
4546
use Psr\Log\LoggerInterface;
4647

@@ -153,6 +154,9 @@ class NodeIndexer extends AbstractNodeIndexer implements BulkNodeIndexerInterfac
153154
#[Flow\Inject]
154155
protected ContentRepositoryRegistry $contentRepositoryRegistry;
155156

157+
#[Flow\Inject()]
158+
protected Context $securityContext;
159+
156160
/** @var array<ContentRepository> */
157161
private array $contentRepositoryRuntimeCache = [];
158162

@@ -270,10 +274,13 @@ public function indexNode(Node $node, ?WorkspaceName $targetWorkspaceName = null
270274
}
271275
};
272276

273-
$handleNode = function (Node $node, WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint) use ($contentRepository, $targetWorkspaceName, $indexer) {
274-
$subgraph = $contentRepository->getContentGraph($workspaceName)->getSubgraph($dimensionSpacePoint, VisibilityConstraints::withoutRestrictions());
275-
$nodeFromContext = $subgraph->findNodeById($node->aggregateId);
276-
277+
$handleNode = function (Node $node, WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint) use ($contentRepository, $targetWorkspaceName, $indexer, &$nodeFromContext) {
278+
$nodeFromContext = $this->securityContext->withoutAuthorizationChecks(
279+
function () use ($contentRepository, $node, $workspaceName, $dimensionSpacePoint) {
280+
$subgraph = $contentRepository->getContentGraph($workspaceName)->getSubgraph($dimensionSpacePoint, VisibilityConstraints::withoutRestrictions());
281+
return $subgraph->findNodeById($node->aggregateId);
282+
}
283+
);
277284
if ($nodeFromContext instanceof Node) {
278285
$this->searchClient->withDimensions(static function () use ($indexer, $nodeFromContext, $targetWorkspaceName) {
279286
$indexer($nodeFromContext, $targetWorkspaceName);

0 commit comments

Comments
 (0)