Review main Merged

75617[BUGFIX] Restore and streamline auth log with MFA

Susi Moog CR +2 V +2 Easy +17 −8 updated 09/23/22, 14:54

Commit message

MFA was preventing the login log entry to be written
as after successful username/password auth MFA was
triggered without logging the first part.
With this patch, the order has been changed to allow
logging of the successful first log in step.
Additionally, the MFA controller is now also using
writeLog to have a complete auth logging including
failed and successful MFA attempts in the backend
log module. MFA related log messages are aligned
to also include the username.

Review

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

Issues 1

Files 2

Review log 1012

  1. Susi Moog uploaded patch set 1 09/06/22, 16:15

  2. core-ci voted on patch set 1 V +1 09/06/22, 16:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30655

  3. Oli Bartsch commented on patch set 1 09/06/22, 19:56

    MfaController.php:192

    There are some things to consider when using writeLog here. For example, we should consider "$user->writeStdLog" here as well. This would then also be the only place, MFA is logging to sys_log. If I remember correct, we did not implement logging to sys_log, because we wanted to achieve a more general logging solution for MFA, which also takes "number of failed login attempts" etc. into account. What do you think of moving the "MFA logging to sys_log" part to a separate patch?

    AbstractUserAuthentication.php:626

    If I remember correct, we placed the MFA evaluation before the logging because actually the user did not successfully login until passing required MFA. Logging this now might confuse admins on debugging unsuccessful login attempts.
  4. Susi Moog commented on patch set 1 09/07/22, 05:20

    AbstractUserAuthentication.php:626 Reply

    That's why I added the logging in MFA (and also the answer to the comment before) - the reordering IMHO only makes sense if we also log to sys_log in MFA because then and only then you get a complete auth log as admin that you can actually interpret correctly (I added a screenshot on forge - you now get "Login Successful - MFA Failed" as sequence which should be less confusing, if we remove the MFA logging, I would agree that it would be too confusing. Technically, isLoggedIn returns true when we get to MFA, so at least the log would be correct that way ;)). As we can see with the forge issue created, it's already confusing for people because nothing is logged atm with MFA. The only other option I could think of, was to keep the successful log-in logging as is and only add it additionally here in MFA (but then we'd have the same state as in your comment #1 and duplicate code on top of it). Do you have any other idea on how to fix this?
  5. Oli Bartsch uploaded patch set 2 09/22/22, 08:52

  6. Oli Bartsch commented on patch set 2 09/22/22, 08:53

    MfaController.php:192 Reply

    Done

    AbstractUserAuthentication.php:626 Reply

    Done
  7. Oli Bartsch voted on patch set 2 V +1 CR +1 09/22/22, 08:55

  8. core-ci voted on patch set 2 V +1 09/22/22, 09:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31418

  9. Andreas Kienast voted on patch set 2 CR +1 09/22/22, 11:38

  10. Andreas Kienast voted on patch set 2 V +1 09/23/22, 14:53

  11. Oli Bartsch voted on patch set 2 V +2 CR +2 09/23/22, 14:54

  12. Oli Bartsch merged patch set 3 09/23/22, 14:54