Review main Abandoned

62035[BUGFIX] Respect "access" option on backend routes

Markus Poerschke CR 0 V 0 Normal +148 −86 updated 11/04/19, 15:48

Commit message

When setting the option "access" to "public" in the configuration file
Configuration/Backend/AjaxRoutes.php, then the route is expected to be
publicly available. Before only a couple of hard coded paths within
the class BackendUserAuthenticator were considered as public and routes
with the "access" option set to "public" were not be able to access
without login.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 7

Review log 1115

  1. Markus Poerschke uploaded patch set 1 10/21/19, 12:12

  2. TYPO3com voted on patch set 1 V -1 10/21/19, 12:23 Completed build in 11m 11s on Mon, 21 Oct, 12:23 PM Test Summary: 4 of 48377 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37410

  3. Markus Poerschke uploaded patch set 2 10/21/19, 16:01

  4. TYPO3com voted on patch set 2 V -1 10/21/19, 16:10 Completed build in 09m 25s on Mon, 21 Oct, 04:10 PM Test Summary: 4 of 48381 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37433

  5. Markus Poerschke uploaded patch set 3 11/03/19, 09:00

  6. TYPO3com voted on patch set 3 V -1 11/03/19, 09:10 Completed build in 09m 44s on Sun, 3 Nov, 09:10 AM Test Summary: 48078 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37938

  7. Oli Bartsch commented on patch set 3 11/03/19, 10:52

    RouteDispatcher.php:83

    Possible null pointer exception here as `$route` could be null if argument `route` doesn't exist.

    BackendRouteMatcher.php:1

    declare strict types

    BackendUserAuthenticator.php:68

    This is wrong, as there is only one parameter registered for `setBackendUserAspect` AFAICS.

    BackendRouteMatcherTest.php:2

    Declare strict types
  8. Markus Poerschke uploaded patch set 4 11/04/19, 10:41

  9. Markus Poerschke commented on patch set 4 11/04/19, 10:42

    This change is ready for review.
  10. Markus Poerschke commented on patch set 4 11/04/19, 10:44

    > Patch Set 3: > > (4 comments) I changed the source code according to the comments,

    RouteDispatcher.php:83 Reply

    Done

    BackendRouteMatcher.php:1 Reply

    Done

    BackendUserAuthenticator.php:68 Reply

    Done

    BackendRouteMatcherTest.php:2 Reply

    Done
  11. TYPO3com voted on patch set 4 V +1 11/04/19, 11:00 Completed build in 11m 54s on Mon, 4 Nov, 11:00 AM Test Summary: 48085 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37967

  12. Simon Gilli commented on patch set 4 11/04/19, 12:09

    Unresolved

    add 9.5 to this line: master, 9.5

    RouteDispatcher.php:70 Unresolved

    parameters should be declared here
  13. Benni Mack commented on patch set 4 11/04/19, 12:52

    Currently "public" means that there is no "token" argument added nor validated. The access toe any backend- related resource is still placed in a middleware. For TYPO3 v9 I'd keep it as is, and suggest you replace the middleware via an extension to make it extensible. For TYPO3 v10, I'd actually move the Routing itself into a middleware, and add a proper registration for backend routes (also on a per-HTTP-verb basis, also adding placeholders). What do you think?
  14. Markus Poerschke commented on patch set 4 CR -1 11/04/19, 15:45

    > Patch Set 4: > > Currently "public" means that there is no "token" argument added nor validated. The access toe any backend- related resource is still placed in a middleware. > > For TYPO3 v9 I'd keep it as is, and suggest you replace the middleware via an extension to make it extensible. > > For TYPO3 v10, I'd actually move the Routing itself into a middleware, and add a proper registration for backend routes (also on a per-HTTP-verb basis, also adding placeholders). What do you think? Indeed I could overcome my problem with an addional Middleware that looks like this (thanks for the idea Benni!): class PublicBackendControllerMiddleware implements MiddlewareInterface { public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { if ($request->getAttribute('routePath') === '/ajax/login/my-public-backend-route') { return $this->myPublicBackendController->someAction($request); } return $handler->handle($request); } } Personally both patches are not needed for my purpose anymore. The advantage of the Middleware-Solution is, that it will work in both versions. Therefore I agree with Bennis remarks: 1. Do not touch v9.5 2. Wait for Benni’s "proper registration for backend routes" 3. Hence I will close, ticket and the reviews.
  15. Markus Poerschke abandoned the change 11/04/19, 15:48

    The change is not needed since an easy workaround in the third-party extension can solve the problem. The backend routes registration will be reworked in v10, therefore this change is obsolete.