Review main Merged

78546[TASK] Reorganize & streamline sudo mode handling

Oliver Hader CR +2 V +2 Expert +1785 −360 updated 04/24/23, 06:56

Commit message

Issue #92836 introduced the "sudo mode" to all admin tool modules,
but with using the session storage of the install tool (based on
PHP native `$_SESSION` handling) - which is different to the usual
behavior and session handling in the TYPO3 backend.

This change changes the session handling to backend user sessions,
add a generic way to configure "sudo mode" per backend routes (not
hardcoding its invocation in the admin tool controller anymore).

In addition, "sudo mode" is now enabled for the extension manager
module as well - this was not possible before, due to the hardwired
implementation to `ext:install`.

In developer context, "sudo mode" is granted automatically (#93160).

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 44

Show 24 more files

Review log 3757

Show 1832 earlier messages
  1. Oliver Hader uploaded patch set 1 04/08/23, 14:12

  2. Oliver Hader uploaded patch set 2 04/08/23, 14:28

  3. core-ci voted on patch set 1 V -1 04/08/23, 14:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40376

  4. core-ci voted on patch set 2 V -1 04/08/23, 15:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40377

  5. Oliver Hader uploaded patch set 3 V -1 04/08/23, 19:26

  6. Oliver Hader uploaded patch set 4 04/08/23, 19:51

  7. core-ci voted on patch set 3 V -1 04/08/23, 19:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40380

  8. core-ci voted on patch set 4 V +1 04/08/23, 19:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40381

  9. Oliver Hader commented on patch set 4 04/09/23, 08:06

    ConfirmationController.php:137

    Needs to consider current site-path, e.g. → `/cms/typo3/` (when installed in `cms` sub directory)
  10. Oliver Hader commented on patch set 5 V +1 04/09/23, 08:07

    Published edit on patch set 4.
  11. Oliver Hader commented on patch set 6 04/09/23, 08:07

    Published edit on patch set 5.
  12. core-ci voted on patch set 6 V +1 04/09/23, 08:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40392

  13. Oliver Hader uploaded patch set 7 V +1 04/09/23, 08:40

  14. Oliver Hader commented on patch set 7 04/09/23, 08:41

    ConfirmationController.php:137 Reply

    Done
  15. core-ci voted on patch set 7 V +1 04/09/23, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40395

  16. Oliver Hader uploaded patch set 8 V +1 04/10/23, 12:17

  17. Oliver Hader rebased onto patch set 9 04/10/23, 12:17

  18. core-ci voted on patch set 8 V -1 04/10/23, 13:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40407

  19. core-ci voted on patch set 9 V -1 04/10/23, 13:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40408

  20. Oliver Hader uploaded patch set 10 V -1 04/10/23, 16:33

  21. core-ci voted on patch set 10 V -1 04/10/23, 16:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40416

  22. Oliver Hader uploaded patch set 11 V -1 04/11/23, 09:36

  23. Oliver Hader uploaded patch set 12 04/11/23, 09:45

  24. core-ci voted on patch set 11 V -1 04/11/23, 09:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40448

  25. core-ci voted on patch set 12 V -1 04/11/23, 10:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40449

  26. Oliver Hader uploaded patch set 13 V -1 04/12/23, 21:29

  27. core-ci voted on patch set 13 V -1 04/12/23, 21:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40533

  28. Oliver Hader uploaded patch set 14 V -1 04/12/23, 21:41

  29. core-ci voted on patch set 14 V -1 04/12/23, 22:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40535

  30. Oliver Hader uploaded patch set 15 V -1 04/13/23, 08:16

  31. core-ci voted on patch set 15 V -1 04/13/23, 08:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40553

  32. Oliver Hader uploaded patch set 16 V -1 04/14/23, 09:51

  1. Oliver Hader marked it ready for review 04/14/23, 09:52

  2. core-ci voted on patch set 16 V +1 04/14/23, 10:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40601

  3. Oliver Hader commented on patch set 16 04/14/23, 10:10

    regular-event.ts:29

    Required, otherwise there were unrelated CodeCeption failures: ``` Acceptance/Application/Extensionmanager/GetExtensionsCest.php:checkRetrievedExtensionsFromTerAreDisplayed Found following JavaScript errors in the browser console: 09:10:16.223 SEVERE - /typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a 4060:12 "TypeError: Cannot read properties of null (reading 'addEventListener')\n at RegularEvent.delegateTo (http://web:8000/typo3temp/var/tests/acceptance/typo3/sysext/core/Resources/Public/JavaScript/event/regular-event.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a:13:220)\n at HTMLDocument.ShortcutMenu.initializeEvents (http://web:8000/typo3temp/var/tests/acceptance/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/shortcut-menu.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a:13:1333)\n at mightThrow (http://web:8000/typo3temp/var/tests/acceptance/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a:3768:29)\n at process (http://web:8000/typo3temp/var/tests/acceptance/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a:3836:12)"; 09:10:16.224 SEVERE - /typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.js?bust=fdba00ea3a15406c2b927fab1c8ee5bb74575a2a 4061:2 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') ``` Not adding events to `null` elements is basically a good thing. However I was not able to track down the root issue in `shortcut-menu.ts` (and why `jQuery` is the initiator here).
  4. Christian Kuhn commented on patch set 16 04/14/23, 10:34

    minor remarks skimming through the code.

    SudoModeController.php:44

    final

    SudoModeController.php:56

    it should be no issue to set all of this (and the properties) private.
  5. Oliver Hader commented on patch set 16 04/14/23, 12:41

    SudoModeController.php:44 Reply

    Fine for me

    SudoModeController.php:56 Reply

    Yepp, when the class in `final`, using `private` is kind of obvious.
  6. Oliver Hader uploaded patch set 17 V +1 04/14/23, 12:41

  7. core-ci voted on patch set 17 V +1 04/14/23, 12:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40620

  8. Benni Mack uploaded patch set 18 V +1 04/14/23, 16:46

  9. core-ci voted on patch set 18 V -1 04/14/23, 17:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40633

  10. Oliver Hader commented on patch set 18 04/15/23, 06:29

    SudoModeController.php:18

    I put the controller to `Backend\Security\SudoMode` on purpose, since that's like the domain of the sudo sudo, a sub-package in the backend component. Putting things to the `Controller` namespace clutters these classes more. However, I'd be fine with that, since the templates for `Controller\Security` are located in `Resources/Private/Templates/Security`.

    RouteAccessSubject.php:57

    `final public function __constructor` was used due to the `static` aspect of the static interface method `fromArray(array $data): static`. See https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
  11. Oliver Hader uploaded patch set 19 V -1 04/15/23, 06:50

  12. core-ci voted on patch set 19 V +1 04/15/23, 06:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40669

  13. Christian Kuhn commented on patch set 19 04/15/23, 09:36

    SudoModeController.php:18 Reply

    yeah. keeping all controllers in Controller/ sub directory is better and sticks to casual expectations. thx.
  14. Oliver Hader commented on patch set 19 04/15/23, 09:39

    SudoModeController.php:18 Reply

    Ack
  15. Oliver Hader uploaded patch set 20 V +1 04/19/23, 17:07

  16. Oliver Hader commented on patch set 20 04/19/23, 17:07

    RouteAccessSubject.php:57 Reply

    Done
  17. core-ci voted on patch set 20 V +1 04/19/23, 17:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40925

  18. Georg Ringer voted on patch set 20 V +1 CR +1 04/23/23, 06:31

  19. Andreas Kienast commented on patch set 20 CR -1 04/24/23, 06:07

    sudo-mode.ts:20

    interface is unused

    sudo-mode.ts:35

    wrong class name

    ServerRequestInstruction.php:88

    Should we make __clone protected as well?
  20. Andreas Kienast uploaded patch set 21 CR +1 V +1 04/24/23, 06:25

  21. Andreas Kienast commented on patch set 21 04/24/23, 06:25

    sudo-mode.ts:20 Reply

    Done

    sudo-mode.ts:35 Reply

    Done

    ServerRequestInstruction.php:88 Reply

    Done
  22. core-ci voted on patch set 21 V +1 04/24/23, 06:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41114

  23. Andreas Kienast voted on patch set 21 V +1 CR +1 04/24/23, 06:36

  24. Benni Mack voted on patch set 21 V +2 CR +2 04/24/23, 06:56

  25. Benni Mack merged patch set 22 04/24/23, 06:56