#105866Backend user access rights overrule frontend user access rights
Description
I have a website with restricted FE user access to most pages.
If there is no backend user logged in, then the restriction works as expected. My FE user can access all the pages where access is granted.
When there is also a backend user logged in into the TYPO3 backend (using the same browser; the FE user is still logged in), then only the frontend pages to which the backend user has access / edit rights in the TYPO3 backend can be viewed in the frontend.
This means that the frontend is not usable for the frontend user as long as he is simultaneously logged into the TYPO3 backend.
This TYPO3 website was migrated from an older version, where this problem did not exist.
The error is caused by the class vendor/typo3/cms-frontend/Classes/Middleware/TypoScriptFrontendInitialization.php
Since version 12 there is a check, which did not not exist before:
// Check if backend user has read access to this page.
if ($this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false)
&& $this->context->getPropertyFromAspect('frontend.preview', 'isPreview', false)
&& !$GLOBALS['BE_USER']->doesUserHaveAccess($controller->page, Permission::PAGE_SHOW)
) {
return GeneralUtility::makeInstance(ErrorController::class)->accessDeniedAction(
$request,
'ID was not an accessible page',
$controller->getPageAccessFailureReasons(PageAccessFailureReasons::ACCESS_DENIED_PAGE_NOT_RESOLVED)
);
}
So if a backend user is logged in and the page is in preview mode, then the access to a page is based on the backend user access rights.
I would suggest to adjust this to:
// Check if backend user has read access to this page.
if ($this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false)
&& $this->context->getPropertyFromAspect('frontend.preview', 'isPreview', false)
&& !$GLOBALS['BE_USER']->doesUserHaveAccess($controller->page, Permission::PAGE_SHOW)
) {
$this->context->unsetAspect('frontend.preview');
}
With that change the preview aspect is unset and the page can be accessed as expected.
Reviews 5
- 12.4 88798[BUGFIX] Allow to visit pages if editor has no access
- main 88762[BUGFIX] Allow to visit pages if editor has no access
- 13.4 88797[BUGFIX] Allow to visit pages if editor has no access
- main 82452[TASK] Streamline TypoScriptFrontendItitialization
- main 73905[TASK] Move BE_USER check from TSFE into middleware
Related issues 4
History 1519
-
Garvin Hicking changed Related to #97176 <span data-processor="relativetime" data-value="2024-12-28T14:38:53+00:00" > 12/28/24, 14:38 </span>
-
Garvin Hicking changed Related to #102856 <span data-processor="relativetime" data-value="2024-12-28T14:41:33+00:00" > 12/28/24, 14:41 </span>
-
Garvin Hicking commented and changed category status
NewNeeds Feedback <span data-processor="relativetime" data-value="2024-12-28T14:44:31+00:00" > 12/28/24, 14:44 </span> -
cosmoblonde GmbH commented <span data-processor="relativetime" data-value="2024-12-28T15:57:06+00:00" > 12/28/24, 15:57 </span>
It will take me some time to have a v13 version setup for testing. Sorry for a delay…
However looking at the code in Classes/Middleware/TypoScriptFrontendInitialization.php, it seems that the lines causing the issue have been removed, so I assume it will not be an issue in v13.And yes, I am aware that testing frontend login-related functionality should be disconnected from any backend login. But in that specific case, it was not a frontend-login test but a real use case: Having hundreds of users with BE accounts having very resticted access rights to the BE and FE accounts with reading access to many more pages then they are allowed to edit with their BE accounts. Additionally, users are logged in via SSO and stay logged in. So a real separation by using incognito tabs is no option.
My suggested change will solve the problem for my use cases. Is this something you can implement in v12?
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-12-28T16:49:29+00:00" > 12/28/24, 16:49 </span>
Thanks, I understand your scenario better now.
With t3v13 it’s become easier to replace the affected code with a custom middleware.
V12 is now in “priority bugfix” mode, and this change may affect how other instances work, so honestly I’m it sure if v12 would receive a general patch level release for it. This is not my personal decission to make, I’ll bring it up in the team after the holidays.
(Please feel free to remind/ping me if it gets “lost” in the year turnaround 😅)
-
cosmoblonde GmbH commented <span data-processor="relativetime" data-value="2025-01-13T12:05:59+00:00" > 01/13/25, 12:05 </span>
This is a little reminder for this “priority bugfix”. ;-)
It would be good to know if a fix is planned in the near future.
Thank you! -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-01-13T20:54:09+00:00" > 01/13/25, 20:54 </span>
Hi!
Did you get the chance to test this with v13? As mentioned this would affect the road to take… :-)
Thanks!
-
cosmoblonde GmbH commented <span data-processor="relativetime" data-value="2025-01-15T12:19:13+00:00" > 01/15/25, 12:19 </span>
Hi!
we have now tested that scenario with v13 and all works as expected.
So this is a v12 bug “only”.
In the meantime we have discovered that this problem affects several of our TYPO3 projects and does not seem to be an usual setup for bigger sites having lots of BE and FE users. So I think a v12 fix is strongly required.Thank you!
-
Sybille Peters changed Related to #104629 <span data-processor="relativetime" data-value="2025-01-28T09:51:45+00:00" > 01/28/25, 09:51 </span>
-
Sybille Peters changed Related to #101589 <span data-processor="relativetime" data-value="2025-01-28T10:02:37+00:00" > 01/28/25, 10:02 </span>
-
cosmoblonde GmbH commented <span data-processor="relativetime" data-value="2025-03-21T15:03:48+00:00" > 03/21/25, 15:03 </span>
@ghi this is a little reminder. Has there been a decision, if this will be fixed in v12?
For all my v12 projects, a patch containing the suggested fix above works fine
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-21T18:14:03+00:00" > 03/21/25, 18:14 </span>
Thanks for the ping, I’ll check!
-
Georg Ringer commented <span data-processor="relativetime" data-value="2025-03-23T22:02:50+00:00" > 03/23/25, 22:02 </span>
hey. isn’t this a duplicate of #101589?
-
Gerrit Code Review pushed patch set 2 for main to change 88762 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2025-03-27T11:32:05+00:00" > 03/27/25, 11:32 </span> -
Gerrit Code Review pushed patch set 1 for 13.4 to change 88797 <span data-processor="relativetime" data-value="2025-03-27T12:24:40+00:00" > 03/27/25, 12:24 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 88798 <span data-processor="relativetime" data-value="2025-03-27T12:24:53+00:00" > 03/27/25, 12:24 </span>
-
Gerrit Code Review pushed patch set 2 for 12.4 to change 88798 <span data-processor="relativetime" data-value="2025-03-27T12:28:30+00:00" > 03/27/25, 12:28 </span>
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-03-27T12:40:08+00:00" > 03/27/25, 12:40 </span>Applied in changeset commit:7e34ac73d0df9d88ee1fa9a8b75dbcdb272c2873.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:27:08+00:00" > 12/02/25, 14:27 </span>
This check was introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/73905 – but then again for v13 changed again with https://review.typo3.org/c/Packages/TYPO3.CMS/+/82452
Could you see if the issue persists for you with the v13 version? That would help to decide how to proceed.
However: I do think there are more places in the frontend evaluation that will take a Backend-User account into consideration, if a login exists, and overrides that. It is best practice to test frontend login-related functionality always in an incognito tab or with a second browser, because a backend user login changes a lot in frontend context also related to caching.