Issue Bug Under Review Orphaned

#106343403 and misleading error in FE when NOT logged in if page is descendant of hidden=1 and extendToSubpages=1

Sybille Peters 03/08/25, 09:46 updated 03/12/26, 14:19

Description

Reproduce

prerequisites:
  • we are not logged in the BE
  • there is no access restriction on the page (e.g. FE user)

1. Create a page test with hidden=1 and extendToSubpages=1
2. Create a not hidden subpage test2
3. Load the page test2 in the frontend (not logged in the backend)

We expect to get a 404 (like for hidden pages), but we get a 403:

Error message

> 403
> Page Not Found
> The page did not exist or was inaccessible. Reason: Subsection was found and not accessible

Also, the error message is misleading and non-intuitive.

(I tried to find existing issue but found lots of issues with preview. This is about not being logged in the BE and there is no FE user or access restriction).

Versions

  • reproduced with latest main (14.0.0-dev)
  • also reproduced with latest v12 (12.4.28-dev)

Reviews 1

History 414

  1. Sybille Peters commented <span data-processor="relativetime" data-value="2025-03-08T09:50:02+00:00" > 03/08/25, 09:50 </span>

    In PageInformationFactory::checkRootlineForIncludeSection we set the 403 and error code PageAccessFailureReasons::ACCESS_DENIED_SUBSECTION_NOT_RESOLVED for a variety of reasons as $this->accessVoter->accessGrantedForPageInRootLine also returns false if page in rootline is extendToSubpages and hidden.

    protected function checkRootlineForIncludeSection(ServerRequestInterface $request, PageInformation $pageInformation): void
    {
        $rootLine = $pageInformation->getRootLine();
        for ($a = 0; $a < count($rootLine); $a++) {
            $rootLineEntry = $rootLine[$a];
            if (!$this->accessVoter->accessGrantedForPageInRootLine($rootLineEntry, $this->context)) {
            // accessGrantedForPageInRootLine() does the main check for 'extendToSubpages'.
            $response = $this->errorController->accessDeniedAction(
                $request,
                'Subsection was found and not accessible',
                [
                    'code' => PageAccessFailureReasons::ACCESS_DENIED_SUBSECTION_NOT_RESOLVED,
                    'sub_section' => [
                        0 => $rootLineEntry,
                    ],
                ],
            );
            throw new PageInformationCreationFailedException($response, 1705337296);
            }