Review main Merged

67637[BUGFIX] Keep session object in sync with session storage values

Ralf Zimmermann CR +2 V +2 Normal +86 −13 updated 05/03/21, 19:07

Commit message

Ensure that changes done to session records in the respective backends
are updated by building a new session object, so
specifically the ses_tstamp value is updated.

Besides that, set the ipLock information on the session object instead
of the deduced session record making consecutive session updates
idempotent.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Markus Klein +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Laurent Foulloy +1
    • Markus Klein +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 4463

Show 2338 earlier messages
  1. Ralf Zimmermann uploaded patch set 1 02/03/21, 16:29

  2. TYPO3com voted on patch set 1 V +1 02/03/21, 16:36 Completed build in 07m 03s on Wed, 3 Feb, 04:36 PM Test Summary: 32585 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9217

  3. Markus Klein commented on patch set 1 02/03/21, 22:40

    Extremely good finding! Thanks. I'm not sure yet about the solution here, but I do not have a better idea either. So please give me some time to think about this in detail.
  4. Benni Mack voted on patch set 1 V +1 CR +1 03/02/21, 09:04

  5. Oli Bartsch voted on patch set 1 V +1 CR +1 03/02/21, 09:17

  6. Markus Klein commented on patch set 1 CR -1 03/09/21, 17:04

    proposing a different solution
  7. Markus Klein uploaded patch set 2 03/09/21, 17:12

  8. TYPO3com voted on patch set 2 V +1 03/09/21, 17:19 Completed build in 07m 01s on Tue, 9 Mar, 05:19 PM Test Summary: 32680 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9985

  9. core-ci voted on patch set 2 V +1 03/09/21, 17:24 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1340

  10. Markus Klein updated the commit message in patch set 3 03/10/21, 20:15

  11. TYPO3com voted on patch set 3 V +1 03/10/21, 20:22 Completed build in 06m 25s on Wed, 10 Mar, 08:22 PM Test Summary: 32680 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10023

  12. core-ci voted on patch set 3 V +1 03/10/21, 20:30 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1383

  13. Oli Bartsch commented on patch set 3 03/10/21, 20:31

    UserSession.php:88

    Would prefer `public function setLastUpdated(int $lastUpdated): void` Otherwise this is kind of a blackbox for the calling code and IMO also not really common behaviour for a setter "Give me some array and I'll look for suitable data myself". I would also appreciate a PHPDoc, to be consistent with the rest of the class.
  14. Markus Klein uploaded patch set 4 03/10/21, 20:51

  15. TYPO3com voted on patch set 4 V -1 03/10/21, 20:52 Completed build in 19s on Wed, 10 Mar, 08:52 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10027

  16. Markus Klein uploaded patch set 5 03/10/21, 20:53

  17. Markus Klein commented on patch set 5 03/10/21, 20:55

    UserSession.php:88 Reply

    I actually had it like this already, and then chose to change it to the current behaviour, because all other methods extract the data also. Moreover I can keep the actual session record field names (like ses_tstamp) rather "local" in this one class. Otherwise I need to call `setLastUpdated($record['ses_tstamp'])` hence exposing this "internal knowledge" in yet another class
  18. core-ci voted on patch set 4 V -1 03/10/21, 20:57 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1387

  19. TYPO3com voted on patch set 5 V +1 03/10/21, 21:00 Completed build in 06m 56s on Wed, 10 Mar, 09:00 PM Test Summary: 32684 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10028

  20. core-ci voted on patch set 5 V +1 03/10/21, 21:03 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1388

  21. Oli Bartsch uploaded patch set 6 03/10/21, 21:15

  22. Oli Bartsch commented on patch set 6 V +1 CR +1 03/10/21, 21:16

    UserSession.php:88 Reply

    Ack. Just added the PHPDoc. Thanks for the adjustments.
  23. Markus Klein commented on patch set 6 03/10/21, 21:17

    Thanks @oliver
  24. TYPO3com voted on patch set 6 V +1 03/10/21, 21:22 Completed build in 07m 01s on Wed, 10 Mar, 09:22 PM Test Summary: 32684 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10030

  25. core-ci voted on patch set 6 V +1 03/10/21, 21:27 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1391

  26. Laurent Foulloy commented on patch set 6 V +1 CR +1 03/10/21, 22:02

    Thanks for the patch
  27. Benni Mack commented on patch set 6 CR -1 03/11/21, 20:08

    UserSessionManager.php:168 Unresolved

    With this change, the $session (UserSession) entity will have an inconsistent state. I thought of this a few months ago. I suggest we either create a new session object (via a factory method) and return it here again (preferred option), or we create a „FixatedSession“ object (= new class) which works by composition of the UserSession (larger change) and we‘ll also add a UserSessionInterface which will be injected everywhere.
  28. Benni Mack uploaded patch set 7 03/11/21, 20:55

  29. Benni Mack commented on patch set 7 03/11/21, 20:56

    I hope my change is OK for everyone involved, would love to get some feedback if this PS is OK.
  30. TYPO3com voted on patch set 7 V -1 03/11/21, 21:03 Completed build in 07m 37s on Thu, 11 Mar, 09:03 PM Test Summary: 53 of 32920 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10055

  31. Benni Mack commented on patch set 7 03/11/21, 21:06

    Ah, now I see I'd need to adapt even more things :( sorry for the confusion.
  32. core-ci voted on patch set 7 V -1 03/11/21, 21:16 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1427

  33. Laurent Foulloy voted on patch set 7 V -1 03/12/21, 12:36

  34. Benni Mack uploaded patch set 8 04/06/21, 20:22

  35. TYPO3com voted on patch set 8 V +1 04/06/21, 20:30 Completed build in 07m 52s on Tue, 6 Apr, 08:30 PM Test Summary: 33271 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10514

  36. core-ci voted on patch set 8 V +1 04/06/21, 20:36 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2063

  37. Xavier Perseguers commented on patch set 8 V -1 04/06/21, 20:52

    FYI: conflicts with https://review.typo3.org/c/Packages/TYPO3.CMS/+/68716 -1 for the verification since it does not solve a regression I spotted: when you ask to reset your password, you enter your username/email and it sends you an email with a link and at the same time redirects you to the login form. It should show a flash message with the info that an email was sent but actually no flash message is shown, the session keeps somehow being invalidated when going back to the login form. The flash message is properly stored in DB though but in that case I think the session should not be anonymous anymore or ensured to be the one computed previously.
  38. Markus Klein commented on patch set 8 04/06/21, 21:01

    UserSessionManager.php:253 Unresolved

    It seems a bit overkill to read the session again from the backend, when it is already there actually
  1. Benni Mack uploaded patch set 9 04/07/21, 15:11

  2. TYPO3com voted on patch set 9 V +1 04/07/21, 15:18 Completed build in 07m 19s on Wed, 7 Apr, 03:18 PM Test Summary: 33271 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10523

  3. core-ci voted on patch set 9 V +1 04/07/21, 15:22 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2075

  4. Markus Klein commented on patch set 9 04/07/21, 20:59

    AbstractUserAuthentication.php:1093

    we have to update this usage too, right?
  5. Laurent Foulloy voted on patch set 9 V +1 04/08/21, 09:11

  6. Oliver Hader commented on patch set 9 V +1 04/23/21, 09:52

    At least fixed #93974
  7. Benni Mack uploaded patch set 10 04/30/21, 21:16

  8. Benni Mack commented on patch set 10 04/30/21, 21:17

    AbstractUserAuthentication.php:1093 Reply

    good catch! thanks
  9. core-ci voted on patch set 10 V +1 04/30/21, 21:27 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10988

  10. Markus Klein voted on patch set 10 CR +1 04/30/21, 21:36

  11. Guido Schmechel voted on patch set 10 CR +1 05/01/21, 10:17

  12. Benni Mack voted on patch set 10 V +1 CR +1 05/01/21, 11:43

  13. Laurent Foulloy commented on patch set 10 V -1 05/01/21, 20:07

    Sorry I forgot to clean the coockies of my browser when testing Patch 9. I get for Patch9 and 10 the error: Call to a member function isNew() on null when the method isSetSessionCookie() in FrontendUserAuthentication.php is called.
  14. Laurent Foulloy commented on patch set 10 05/02/21, 14:05

    Reply

    Sorry, Patch 10 was not applied correctly leading to the error. Patch is now correctly applied. Nevertheless it does not solve completely #93386. The following non-cachable default action is used for testing public function defaultAction() { $frontEndUser = $GLOBALS['TSFE']->fe_user; $value = $frontEndUser->getKey('ses', 'Test'); $value = $value + 1; $frontEndUser->setKey('ses', 'Test', $value); $frontEndUser->storeSessionData(); $this->view->assign('value', $value); } Data stored in the session are not recovered when the page is reloaded and the user is not authenticated.
  15. Oliver Hader commented on patch set 10 V -1 05/03/21, 14:05

    I don't get exceptions anymore (good) - but I also don't get any frontend user cookie anymore. My test scenario (on same page) * ext:felogin plugin (invokes flash messages, has session interaction) * ext:form plugin (invokes honey pot field, has session interaction)
  16. Oliver Hader commented on patch set 10 CR -1 05/03/21, 15:00

    I'm on it..
  17. Oliver Hader uploaded patch set 11 05/03/21, 15:56

  18. core-ci voted on patch set 11 V +1 05/03/21, 16:06 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11055

  19. Oliver Hader commented on patch set 11 05/03/21, 16:16

    Reply Unresolved

    Salut, I've tested this scenario using a `USER_INT` via TypoScript and method `testCounter` containing the source code from above. With PS11 this seems to be working. ``` page { 20 = USER_INT 20.userFunc = Vendor\Example\ContentController->testCounter } ```
  20. Oliver Hader voted on patch set 11 V +1 CR +1 05/03/21, 16:16

  21. Markus Klein voted on patch set 11 CR +1 05/03/21, 17:04

  22. Markus Klein voted on patch set 11 V +1 05/03/21, 18:02

  23. Laurent Foulloy commented on patch set 11 V +1 05/03/21, 18:06

    Thank you very much for this patch.
  24. Oliver Hader voted on patch set 11 V +2 CR +2 05/03/21, 19:06

  25. Oliver Hader merged patch set 12 05/03/21, 19:07