91172[FEATURE] Introduce Extbase action authorization attribute
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Georg Ringer +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Garvin Hicking +2
- Georg Ringer +1
- Oliver Klee +1
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 13
- typo3/sysext/core/Documentation/Changelog/14.2/Feature-107826-IntroduceExtbaseActionAuthorizationLogic.rst4new+305 −0
- typo3/sysext/extbase/Classes/Attribute/Authorize.php4new+35 −0
- typo3/sysext/extbase/Classes/Authorization/AuthorizationFailureReason.phpnew+25 −0
- typo3/sysext/extbase/Classes/Authorization/AuthorizationResult.phpnew+56 −0
- typo3/sysext/extbase/Classes/Event/Mvc/BeforeActionAuthorizationDeniedEvent.phpnew+80 −0
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php6+74 −1
- typo3/sysext/extbase/Classes/Reflection/ClassSchema/Method.php+10 −0
- typo3/sysext/extbase/Classes/Reflection/ClassSchema.php2+6 −0
- typo3/sysext/extbase/Classes/Service/ActionAuthorizationService.php5new+157 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/action_controller_test/Classes/Controller/AccessCheckController.phpnew+71 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/action_controller_test/Classes/Service/ActionAccessCheckService.phpnew+26 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/action_controller_test/Configuration/Services.yaml+3 −0
- typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ActionControllerAccessCheckTest.phpnew+372 −0
Review log 4662
Show 2637 earlier messages
-
Torben Hansen uploaded patch set 1 10/20/25, 17:06
-
core-ci voted on patch set 1 V -1 10/20/25, 17:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87103
-
Torben Hansen uploaded patch set 2
V -110/20/25, 17:18 -
Torben Hansen uploaded patch set 3 10/20/25, 17:18
-
core-ci voted on patch set 2 V -1 10/20/25, 17:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87104
-
core-ci voted on patch set 3 V -1 10/20/25, 17:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87105
-
Simon Schaufelberger commented on patch set 3 10/20/25, 17:36
So cool that you are working on this! Are you just coming up with your own ideas or do you make it similar like other php frameworks? I'm using the access checks from Laravel (ported to TYPO3) and could give some feedback -
Torben Hansen commented on patch set 3 10/20/25, 17:44
Reply
@typo3@helhum.io came up with the idea for this one when we were discussing another patch. This is the currently a WIP draft for a possible general and simple access check solution for extbase actions. Feedback is highly appreciated 👍 -
Simon Schaufelberger commented on patch set 3 10/21/25, 14:41
Reply
Here are my feature requests: - The currently logged in user should be easily accessible. In Laravel it is passed automatically to every method. I'm using a custom Model for the Frontend User that I pass to every auth check method. - In case I'm editing/deleting an existing object, this object must be easily accessible. - There should be 2 ViewHelpers: CanViewHelper and CannotViewHelper where the access can also be executed within Fluid. - In case the user has no access, a proper "you don't have access" page must be rendered like the ErrorController already does with the accessDeniedAction. -
Torben Hansen uploaded patch set 4
V -110/24/25, 08:37 -
core-ci voted on patch set 4 V +1 10/24/25, 08:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87474
-
Torben Hansen commented on patch set 4 10/24/25, 08:54
Reply
Thanks for your feedback. Nearly all mentioned feature requests are valid, I however think they are outside of the scope of this patch and should be implemented by the extension developer. The current logged in user is already accessible via PSR-7 request attribute `frontend.user`. Since we for good reasons have no generic extbase domain model for a frontend user, it is best to let developers take care of resolving the object in the access check logic. The patch will always provide the same arguments as the action has. So it is possible to e.g. use the provided domain model (resolved via property mapper) to perform access checks. I do not agree we need new ViewHelpers, since one could argue, that e.g. controller logic should already exclude non accessible objects for the user. Additionally, the suggested ViewHelpers will always depend on custom logic, which the core can not provide. The patch ensures, that a `PropagateResponseException` is thrown in case an access check failed. This will ensure, that extbase will not continue with logic from other plugins and accidently cache data or even persist possible crafted data via `PersistenceManager`. The exception can be handled in a page error handler per site. All in all, this feature will only provide the possibility to implement custom access checks in extbase. The custom access check logic should be implemented by the extension developer (e.g. provide a service with access check methods, which can be used in controllers and ViewHelpers). -
Torben Hansen marked it work in progress 10/24/25, 12:59
-
Torben Hansen uploaded patch set 5
V +111/12/25, 08:37 -
core-ci voted on patch set 5 V +1 11/12/25, 08:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89164
-
Torben Hansen uploaded patch set 6
V +112/10/25, 18:11 -
core-ci voted on patch set 6 V +1 12/10/25, 18:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92010
-
Torben Hansen uploaded patch set 7
V +112/14/25, 14:11 -
core-ci voted on patch set 7 V +1 12/14/25, 14:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92216
-
Torben Hansen uploaded patch set 8
V +112/20/25, 08:53 -
Torben Hansen uploaded patch set 9 12/20/25, 08:55
-
core-ci voted on patch set 8 V +1 12/20/25, 09:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92504
-
core-ci voted on patch set 9 V +1 12/20/25, 09:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92505
-
Torben Hansen rebased onto patch set 10
V +112/20/25, 09:09 -
Torben Hansen marked it ready for review 12/20/25, 09:09
-
Torben Hansen commented on patch set 10 12/20/25, 09:09
Reply
Done -
core-ci voted on patch set 10 V +1 12/20/25, 09:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92506
-
Oliver Klee voted on patch set 10 CR +1 V +1 12/20/25, 09:56
-
Garvin Hicking voted on patch set 10 CR +1 V +1 12/20/25, 14:41
-
Guido Schmechel voted on patch set 10 CR +1 V +1 12/22/25, 09:33
-
Benni Mack commented on patch set 10 12/22/25, 15:29
I wonder if we should / could use PHP Attributes for this... the main benefit is that we do not need to work with inheritance in this case und thus make the actual ActionController a bit thinner. PHP Frameworks try to keep the controller classes as small as possible... -
Garvin Hicking commented on patch set 10 02/20/26, 09:13
Torben, do you have plans to move this forward before feature freeze? -
Torben Hansen commented on patch set 10 02/20/26, 09:18
Reply
Yes, but I want to re-think the concept as @benni@typo3.org suggested and maybe use a PHP attribute instead -
Torben Hansen uploaded patch set 11
CR +1V +103/02/26, 13:45 -
Torben Hansen commented on patch set 11 03/02/26, 13:45
Reply
I created a new patch which uses PHP attributes and has more features. -
Simon Schaufelberger commented on patch set 11 03/02/26, 14:00
ActionAuthorizationService.php:73I would do it similar like the `f:security.ifHasRole` viewhelper with the possibility to also provide it as: `role: 'Administrator'`. What do you think? -
core-ci voted on patch set 11 V -1 03/02/26, 14:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97113
-
Torben Hansen commented on patch set 11 03/02/26, 15:17
ActionAuthorizationService.php:73ReplyI can add this later to have this streamlined with the VH, but I think we should suggest to not use group names for access checks, because the names do not have any logical "binding" to the code. I know, neither does the group UIDs have. Just taking into account experiences from real life projects where users/administrators "clean up" fe_groups by renaming them and potentially breaking implemented access logic using the VHs -
Torben Hansen uploaded patch set 12
V -103/02/26, 18:16 -
Torben Hansen commented on patch set 11 03/02/26, 18:16
ActionAuthorizationService.php:73ReplyDone -
core-ci voted on patch set 12 V +1 03/02/26, 18:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97130
-
Simon Schaufelberger commented on patch set 12 03/02/26, 20:55
Feature-107826-IntroduceExtbaseActionAuthorizationLogic.rst:295I would mention it clearer if authorization is always checked or only for non-cached actions? It is very important to make this clear.ActionController.php:978annotation can be dropped as not usefullActionAuthorizationService.php:31protected -
Torben Hansen uploaded patch set 13
V +103/03/26, 07:23 -
Torben Hansen commented on patch set 12 03/03/26, 07:24
Feature-107826-IntroduceExtbaseActionAuthorizationLogic.rst:295ReplyThis follows the known TYPO3 logic for cached and uncached actions. For uncached action, the authorization will always be performed. In case of a cached action, the authorization is executed once and WOULD be cached. Therefore, the feature by default throws the PropagateResponseException to ensure, it is not cached and authorization is always executed also for cached actions. So by default, everything works as intended, but if developers decide to use the PSR-14 event to implement custom logic and to work with a custom PSR-7 response which will be handled by the extbase dispatcher, they have to be more carefull as outlined in the section about the event. So IMO nothing to adapt here.ActionController.php:978ReplyDoneActionAuthorizationService.php:31ReplyDone -
core-ci voted on patch set 13 V +1 03/03/26, 07:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97154
-
Elias Häußler commented on patch set 13 03/03/26, 08:52
Authorize.php:24Since PHP 8.5, Closures are supported for attributes as well (see https://laravel-news.com/support-closures-in-constant-expressions-in-php-8-5). Should we probably allow these here as well? In addition, I think it would be nice to have support for invokable classes in place as well.Authorize.php:28```suggestion if ($callback === null && !$requireLogin && $requireGroups === []) { ```ActionController.php:975```suggestion * {@see BeforeActionAuthorizationDeniedEvent}. ```ActionController.php:986```suggestion if ($authorizeAttributes === []) { ```ClassSchema.php:231AFAICS this should be ```suggestion /** @var list<Attribute\Authorize> $authorize */ ``` -
Simon Schaufelberger commented on patch set 13 03/03/26, 10:46
Feature-107826-IntroduceExtbaseActionAuthorizationLogic.rst:295Reply"In case of a cached action, the authorization is executed once and WOULD be cached". "Therefore, the feature by default throws the PropagateResponseException to ensure, it is not cached and authorization is always executed also for cached actions." That is confusing for me. Can you please explain that in the rst file? -
Torben Hansen commented on patch set 13 03/03/26, 12:11
Feature-107826-IntroduceExtbaseActionAuthorizationLogic.rst:295ReplyAt the top of the RST, it is explained, that a PropagateResponseException is thrown by default to stop extbase dispatcher. No need here to explain what TYPO3 would do, if no PropagateResponseException is thrown. In the section about the PSR-14 event to return a custom, user-defined PSR-7 response it is explained, that this should be used for uncached actions only to avoid response data being cached. Both scenarios are therefore clear in my opinion. A feature RST should only cover the new feature and not go into details about how TYPO3 behaves in terms of page caching when handling cached/uncached extbase action responses. This should be part of the general extbase documentation. -
Torben Hansen uploaded patch set 14
V +103/03/26, 14:59 -
Torben Hansen commented on patch set 13 03/03/26, 14:59
Authorize.php:24ReplyI think we should add implement closure support for the attribute in a later TYPO3 major version to avoid confusion for developers using PHP v 8.5 The invokable classes feature might be a nice to have, but I think we should avoid it here in order to advise developers to use a central service class for all authorization checks of a controller/applicationAuthorize.php:28ReplyDoneActionController.php:975ReplyDoneActionController.php:986ReplyDoneClassSchema.php:231ReplyDone -
core-ci voted on patch set 14 V +1 03/03/26, 15:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97191
-
Torben Hansen uploaded patch set 15
V +103/03/26, 17:44 -
core-ci voted on patch set 15 V +1 03/03/26, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97206
-
Torben Hansen uploaded patch set 16
V +103/04/26, 07:34 -
core-ci voted on patch set 16 V +1 03/04/26, 07:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97261
-
Georg Ringer voted on patch set 16 CR +1 V +1 03/04/26, 07:54
-
Torben Hansen commented on patch set 16 03/04/26, 07:57
Reply
Done -
Oliver Klee voted on patch set 16 V +1 03/04/26, 08:08
-
Garvin Hicking commented on patch set 16 CR +1 V +1 03/04/26, 08:32
I have tested this more with "dummy" usage scenarios, and not in a real-world project situation. I think this should cover all cases though that I'm currently thinking of. -
Simon Schaufelberger voted on patch set 16 CR +1 V +1 03/04/26, 10:04
-
Garvin Hicking voted on patch set 16 CR +2 V +2 03/04/26, 13:01
-
Garvin Hicking merged patch set 17 03/04/26, 13:01