Review main Abandoned

80261[BUGFIX] Handle missing BE_USER in BackendUserAuthenticator

Markus Klein CR 0 V 0 Easy +1 −1 updated 08/04/23, 12:50

Commit message

In some cases it can happen that the global BE_USER
is not set anymore.
Ensure the code handles this case correctly
and avoid PHP warnings.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 89

  1. Markus Klein uploaded patch set 1 07/31/23, 07:24

  2. Thomas Hohn voted on patch set 1 CR +1 07/31/23, 07:28

  3. core-ci voted on patch set 1 V +1 07/31/23, 07:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44778

  4. Oliver Klee voted on patch set 1 CR +1 07/31/23, 07:39

  5. Christian Kuhn commented on patch set 1 CR -1 07/31/23, 09:25

    BackendUserAuthenticator.php:160

    This is fishy, isn't it? This middleware sets GLOBALS['BE_USER'] early on. There should be no other middleware or controller afterwards which unsets this global again, it would indicate a bug in a middleware or controller below. Thus, when the response comes up here, we should expect GLOBALS['BE_USER'] to still exist since nobody below should unset this one again. Which code fiddles with unsetting that global? I just went through the default core backend middlewares (not all controllers, though), and it looks as if nobody touches it anymore?! I'd actually tend to harden enrichResponseWithHeadersAndCookieInformation() instead to make BackendUserAuthentication not nullable.
  6. Markus Klein commented on patch set 1 07/31/23, 12:40

    BackendUserAuthenticator.php:160 Reply

    I don't know if this is fishy, we just saw that error message on production v11. Until now we only figured that the user seems to be logged out at this point. Nothing really special going on in this instance. I will try to keep digging on how this happens; rather "who f**" is unsetting BE_USER ;-)
  7. Benni Mack commented on patch set 1 07/31/23, 13:56

    BackendUserAuthenticator.php:160 Reply

    I can tell you: EXT:solr for example.
  8. Markus Klein commented on patch set 1 07/31/23, 14:41

    BackendUserAuthenticator.php:160 Reply Unresolved

    Gnaaa, Okay that's indeed a hot guess. I'm not sure though, I need to find out the specific action from the BE user that caused this, to see if any hook/event is actually likely to be involved or not.
  9. Markus Klein abandoned the change 08/04/23, 12:50

    cannot be reproduced at the moment