Review main Merged

66630[TASK] Introduce sudo mode for install tool accessed via backend

Oliver Hader CR +2 V +2 Hard +432 −20 updated 11/16/20, 15:17

Commit message

The session expiration time for the install tool is reduced from
60 to 15 minutes. When accessing the install tool via backend user
interface, currently logged in backend users have to confirm their
user password again in order to get access to the install tool.
This process is known as "sudo mode".

Standalone install tool is not affected by sudo mode confirmation.
This change enforces mitigation as mentioned in TYPO3-CORE-SA-2020-006,
see https://typo3.org/security/advisory/typo3-core-sa-2020-006.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Markus Klein +1
    • Torben Hansen +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Markus Klein +1
    • Torben Hansen +1
    • TYPO3com +1 CI

Issues 1

Files 10

Review log 4259

Show 2434 earlier messages
  1. Oliver Hader uploaded patch set 1 11/13/20, 17:44

  2. Oliver Hader updated the commit message in patch set 2 11/13/20, 17:44

  3. TYPO3com voted on patch set 1 V +1 11/13/20, 17:58 Completed build in 13m 49s on Fri, 13 Nov, 05:58 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7292

  4. TYPO3com voted on patch set 2 V +1 11/13/20, 18:03 Completed build in 15m 02s on Fri, 13 Nov, 06:03 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7293

  5. Markus Klein commented on patch set 2 11/13/20, 22:12

    If I'm not mistaken, it was once decided (mainly in the docs) that words like Frontend, Backend, Install Tool and Core are proper nouns.
    currently

    BackendModuleController.php:78

    true as 3rd param

    BackendModuleController.php:204

    should we still have this rsaauth stuff in master?

    SessionService.php:89

    be very cautious with this stuff. It took me hours fiddling around with this PHP internal (sorry) mess. I hope I remember this correctly, but calling session_status() already mangles the PHP session state somehow and in in the end the cookies are set too early or not removed or or or. If this is just a "drive by" change, I would highly suggest to NOT do this.
  6. Oliver Hader commented on patch set 2 11/14/20, 09:31

    Reply Unresolved

    Never heard about that...

    Reply

    Ack

    BackendModuleController.php:78 Reply

    Ack

    SessionService.php:89 Reply

    There is no other way doing this when relying in `SID`... in case any other process did some session handling (and took care of closing/finishing it) the game is over already... For instance ext:rsaauth split storage is putting data into its own session - thus defines `SID`. I could not find any evidence on your statement concerning `session_status()` - feel free to share your experience code-wise here... ``` echo '<?php\nvar_dump(session_status());' | php-cgi70 X-Powered-By: PHP/7.0.33 Content-type: text/html; charset=UTF-8 <pre class='xdebug-var-dump' dir='ltr'> <small>-:2:</small><small>int</small> <font color='#4e9a06'>1</font> </pre>% ``` * does not send any session cookie (use `session_start()` instead, to see the difference) * responds with `PHP_SESSION_NONE` (1) which is correct
  7. Oliver Hader updated the commit message in patch set 3 11/14/20, 09:31

  8. Oliver Hader commented on patch set 4 11/14/20, 09:33

    Published edit on patch set 3.
  9. Oliver Hader commented on patch set 4 11/14/20, 09:36

    BackendModuleController.php:204 Reply

    Still can be removed later - this way it's easier to maintain back-ports to 10.4 and 9.5
  10. TYPO3com voted on patch set 3 V +1 11/14/20, 09:45 Completed build in 13m 43s on Sat, 14 Nov, 09:45 AM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7299

  11. TYPO3com voted on patch set 4 V +1 11/14/20, 09:51 Completed build in 16m 08s on Sat, 14 Nov, 09:51 AM Test Summary: 73621 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7300

  12. Christian Kuhn commented on patch set 4 11/14/20, 11:46

    BackendModuleController.php:204 Reply

    Fine with me if that helps with the backport process. I'd however love to not see any rsaauth related code to end up in master (I don't care too much about v10 in this case): The extension has been dropped in v10, looking at https://github.com/TYPO3-CMS/rsaauth there does not even seem to exist a v10 compatible version, so I guess it would be very fine to at least kick that stuff from the master version of the patch before merge. Is that ok with you, Oli?
  13. Oliver Hader commented on patch set 4 11/14/20, 12:33

    > Patch Set 4: > > (1 comment)

    BackendModuleController.php:204 Reply

    ext:rsaauth has been extracted to https://github.com/friendsOfTYPO3/rsaauth (which claims to be compatible with v10) I'm totally fine with removing those rsaauth parts from core master branch once this change is accepted
  14. Oliver Hader uploaded patch set 5 11/14/20, 13:01

  15. Oliver Hader commented on patch set 5 11/14/20, 13:03

    BackendModuleController.php:204 Reply Unresolved

    Create back-ports for v10 and v9 & removed occurrences of rsaauth from master patch...
  16. TYPO3com voted on patch set 5 V +1 11/14/20, 13:12 Completed build in 11m 36s on Sat, 14 Nov, 01:12 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7304

  17. Oliver Hader uploaded patch set 6 11/14/20, 15:04

  18. TYPO3com voted on patch set 6 V -1 11/14/20, 15:16 Completed build in 12m 29s on Sat, 14 Nov, 03:16 PM Test Summary: 1 of 74108 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7306

  19. TYPO3com voted on patch set 6 V +1 11/14/20, 15:22 Completed build in 30m 32s on Sat, 14 Nov, 03:22 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7306

  20. Torben Hansen commented on patch set 6 V -1 11/14/20, 18:48

    BackendModuleController.php:222 Unresolved

    As soon as one of the auth services in the service chain require an additional security factor (e.g. OTP - e.g. ext:cf_google_authenticator or ext:sf_yubikey) or even no password (external auth service - e.g ext:openid), authentication will never be successful. Maybe we would pass an variable to authUser() to identify, that the auth request is initiated by sudo mode, so 3rd party auth services can skip the authentication (e.g. return 100)

    BackendModuleController.php:250

    Should be checked for instanceof AbstractAuthenticationService, since 3rd party extensions usually extend AbstractAuthenticationService. Currently, this ends up in an endless loop when you have a 3rd party authentication service installed which extends AbstractAuthenticationService.
  21. Oliver Hader commented on patch set 6 11/15/20, 12:26

    BackendModuleController.php:250 Reply

    I see the point, and it's fortunate... external services like LDAP use the same "authentication" API as MFA extensions are doing... It would be possible to introduce a "verification" scope - however LDAP et al still would not work
  22. Oliver Hader commented on patch set 6 11/15/20, 12:44

    BackendModuleController.php:250 Reply

    I checked some of those MFA apps which are only implementing for the scope of "login" (using corresponding login provider). So actually they should also check whether the current login status is `login` - if not, it's not of their business to intercept the authentication chain
  23. Torben Hansen commented on patch set 6 11/15/20, 13:53

    BackendModuleController.php:250 Reply

    So you suggest that those extensions should check in e.g. authUser() as following: if ($this->login['status'] !== LoginType::LOGIN) { return 100; } If yes, I think we should add a RST to ensure extension authors of MFA auth services know how to adjust extensions, since the SUDO mode will currently not work, if an auth service is installed that does not check the login status.
  24. Torben Hansen commented on patch set 6 11/15/20, 18:27

    BackendModuleController.php:250 Reply

    If auth service processing is not fully suitable, maybe the install tool password can be used as an alternative for the users password to confirm the sudo?
  25. Oliver Hader uploaded patch set 7 11/15/20, 22:23

  26. Oliver Hader uploaded patch set 8 11/15/20, 22:28

  27. TYPO3com voted on patch set 7 V -1 11/15/20, 22:35 Completed build in 12m 11s on Sun, 15 Nov, 10:35 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7326

  28. TYPO3com voted on patch set 8 V -1 11/15/20, 22:42 Completed build in 14m 07s on Sun, 15 Nov, 10:42 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7327

  29. Oliver Hader commented on patch set 8 11/15/20, 22:44

    BackendModuleController.php:250 Reply Unresolved

    Checking this part again, actually expose a bug in current chain handling (changed now). For "additional" authentication services like the extensions you mentioned, skipping seems to be fine - as long as the relevant data (the hashed password) is available statically. Any other service that involves remote processing is probably not solvable right now - there's no API for defining "re-entry points" - I bet most of these extensions (OpenID et al) are using "hacks" for the purpose of having an "alternative login form". Having a switch to use the install tool password seems to be okay (it was like that until v9).
  30. Oliver Hader voted on patch set 8 CR -1 11/15/20, 22:44

  31. Oliver Hader uploaded patch set 9 11/15/20, 22:53

  32. TYPO3com voted on patch set 9 V +1 11/15/20, 23:08 Completed build in 14m 40s on Sun, 15 Nov, 11:08 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7328

  33. Andreas Kienast commented on patch set 9 V +1 11/16/20, 07:27

    BackendModuleController.php:153 Unresolved

    backen*d* user

    BackendModuleController.php:224

    This seems to be superfluous, `authUser()` is declared to return an integer already.

    BackendModuleController.php:274

    Can we use of DI here?
  34. Oliver Hader uploaded patch set 10 11/16/20, 09:50

  1. Oliver Hader commented on patch set 10 11/16/20, 09:55

    BackendModuleController.php:224 Reply Unresolved

    We don't have an interface for that... thus, any service can return anything

    BackendModuleController.php:274 Reply Unresolved

    It would not solve anything, since the IoC pattern would not solve anything for a static component like the install tool...
  2. Oliver Hader uploaded patch set 11 11/16/20, 09:55

  3. Oliver Hader uploaded patch set 12 11/16/20, 10:00

  4. TYPO3com voted on patch set 10 V +1 11/16/20, 10:09 Completed build in 14m 40s on Mon, 16 Nov, 10:09 AM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7331

  5. Andreas Kienast commented on patch set 12 11/16/20, 10:11

    BackendModuleController.php:292 Unresolved

    Is moving this line _before_ the is_object() check intended?
  6. TYPO3com voted on patch set 11 V -1 11/16/20, 10:13 Completed build in 14m 06s on Mon, 16 Nov, 10:13 AM Test Summary: 1 of 74108 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7332

  7. TYPO3com voted on patch set 12 V +1 11/16/20, 10:18 Completed build in 14m 55s on Mon, 16 Nov, 10:18 AM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7333

  8. Oliver Hader uploaded patch set 13 11/16/20, 10:57

  9. TYPO3com voted on patch set 13 V +1 11/16/20, 11:10 Completed build in 13m 23s on Mon, 16 Nov, 11:10 AM Test Summary: 73622 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7335

  10. Oliver Hader uploaded patch set 14 11/16/20, 11:37

  11. TYPO3com voted on patch set 14 V +1 11/16/20, 11:50 Completed build in 12m 51s on Mon, 16 Nov, 11:50 AM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7336

  12. Alexander Schnitzler voted on patch set 14 V +1 11/16/20, 11:56

  13. Markus Klein commented on patch set 14 11/16/20, 12:34

    SessionService.php:89 Reply Unresolved

    Alright thanks for you digging. I'll apply the patch and do some tests with it regarding "cookie survival".
  14. Georg Ringer uploaded patch set 15 11/16/20, 12:39

  15. Georg Ringer voted on patch set 15 V +1 CR +1 11/16/20, 12:40

  16. Torben Hansen commented on patch set 15 V +1 CR +1 11/16/20, 12:44

    Just one minor typo and one suggestion for UX improvement (see comment for BackendUserConfirmation.html).

    BackendModuleController.php:209 Unresolved

    Minor typo for "installt"

    BackendUserConfirmation.html:36

    Suggestion for UX improvement: Can we automatically get the focus into this field? Would save a mouse click or even several keyboard tabs when navigating with keyboard only.
  17. TYPO3com voted on patch set 15 V +1 11/16/20, 12:51 Completed build in 12m 02s on Mon, 16 Nov, 12:51 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7340

  18. Georg Ringer uploaded patch set 16 11/16/20, 13:22

  19. TYPO3com voted on patch set 16 V +1 11/16/20, 13:57 Completed build in 20m 08s on Mon, 16 Nov, 01:57 PM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7348

  20. Oliver Hader commented on patch set 16 11/16/20, 13:57

    BackendUserConfirmation.html:36 Reply Unresolved

    I tried with `autofocus` in additional attributes - it was rendered in generated HTML, however did not have any effect. Besides that I found a remark on not using `autofocus` at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#htmlattrdefautofocus I'd suggest to address that at a later point...
  21. Oliver Hader voted on patch set 16 CR +1 11/16/20, 14:08

  22. Markus Klein voted on patch set 16 V +1 CR +1 11/16/20, 14:53

  23. Torben Hansen voted on patch set 16 V +1 CR +1 11/16/20, 14:59

  24. Oliver Hader commented on patch set 16 V +2 CR +2 11/16/20, 15:16

    Thx folk for your reviews! :+1:
  25. Oliver Hader merged patch set 17 11/16/20, 15:17