Skip to content

[3.0] Upgrader login fixes#9302

Open
Sesquipedalian wants to merge 7 commits into
SimpleMachines:release-3.0from
Sesquipedalian:3.0/upgrader_login
Open

[3.0] Upgrader login fixes#9302
Sesquipedalian wants to merge 7 commits into
SimpleMachines:release-3.0from
Sesquipedalian:3.0/upgrader_login

Conversation

@Sesquipedalian

@Sesquipedalian Sesquipedalian commented Jul 18, 2026

Copy link
Copy Markdown
Member

Partial fix for #9293

  1. Security fix: uses hash_equals() in SMF\Maintenance\Maintenance::loginAdmin() and SMF\Maintenance\Maintenance::loginWithDatabasePassword() methods.
  2. Logs correct info about who ran the upgrader. Previously, we were doing some silly things with loading and unloading User::$me. Not only was that unnecessary, and not only could it produce inaccurate info in the logs under certain circumstances, but it also further complicated the problems with getting the admin's login cookie right by the time the upgrade was complete.
  3. Moves SMF\Actions\Login2::validatePasswordFlood() to SMF\Security::validatePasswordFlood().
  4. Implements SMF\Security::checkPassword().
  5. Updates the admin's stored password value and updates their login cookie as needed during upgrade.
  6. Fixes bugs with handling login security tokens in the upgrader.
  7. Point 6 ultimately led to replacing Maintenance::$context with just plain old Utils::$context. Upon closer inspection, I realized that there was neither any need nor any benefit to having a separate version of $context; it just caused headaches when using other code, such as SecurityToken::create(), that is already designed to work with Utils::$context.

Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@Sesquipedalian
Sesquipedalian force-pushed the 3.0/upgrader_login branch 4 times, most recently from cbac018 to a73718e Compare July 18, 2026 21:42
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Jul 18, 2026
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@Sesquipedalian

Copy link
Copy Markdown
Member Author

Okay, I think I am done messing with this PR.

@sbulen, would you care to test whether it solves the problem of not being logged after the upgrader exits?

@Sesquipedalian
Sesquipedalian force-pushed the 3.0/upgrader_login branch 9 times, most recently from 7049865 to 8be3518 Compare July 19, 2026 19:06
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@sbulen

sbulen commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

2.1 => 3.0

Fatal error: Uncaught Error: Cannot access uninitialized non-nullable property SMF\User::$username by reference in D:\wamp64\www\van2130\Sources\User.php:807 Stack trace: # 0 [internal function]: SMF\User->$member_name::get() # 1 D:\wamp64\www\van2130\Sources\Utils.php(1539): json_encode(Array, 0, 512) # 2 D:\wamp64\www\van2130\Sources\Services\ErrorHandlerService.php(286): SMF\Utils::jsonEncode(Array) # 3 D:\wamp64\www\van2130\Sources\Services\ErrorHandlerService.php(185): SMF\Services\ErrorHandlerService->log('Cannot access u...', 'general', 'D:/wamp64/www/v...', 807, Array) # 4 D:\wamp64\www\van2130\Sources\ErrorHandler.php(104): SMF\Services\ErrorHandlerService->catch(Object(Error)) # 5 [internal function]: SMF\ErrorHandler::catch(Object(Error)) # 6 {main} thrown in D:\wamp64\www\van2130\Sources\User.php on line 807

  • PHP, MySQL, Apache logs: nothing
  • Upgrader log: nothing

@Sesquipedalian

Sesquipedalian commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Well, phooey. I must have broken something in my tinkering after I first pushed. I suppose that's what I get for trying to code while sleepy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants