Conversation
Session::secure() was called unconditionally before showLoginForm(), so every unauthenticated GET (browser prefetch, the /messages route loaded by the login page, parallel tabs) invalidated the previous session. The set_session hidden field of an already-rendered form then no longer matched the session cookie, and the POST failed with MismatchedSessionId. Session fixation protection is preserved: Session::secure() is still called on successful login in AuthenticationCookie::authenticate(). Only generate a token here when none exists yet. Fixes phpmyadmin#20462 Signed-off-by: Arturo DERGAL - YorkHost <144963931+arturod67@users.noreply.github.com>
|
any update on this? |
|
Merci for this PR ! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20463 +/- ##
============================================
- Coverage 63.93% 63.93% -0.01%
- Complexity 16091 16092 +1
============================================
Files 677 677
Lines 57853 57854 +1
============================================
Hits 36987 36987
- Misses 20866 20867 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks @williamdes! Yes, 5.2 is affected by the same bug and the fix applies there too. On The patch doesn't cherry-pick as-is: the file path differs, and /* Show login form (this exits) */
if (! $success) {
/* Generate session token if missing; regeneration happens on successful login */
if (empty($_SESSION[' PMA_token '])) {
Session::secure();
}
$this->showLoginForm();
}If you'd like, I can open a separate PR against |
Fixes #20462. See the issue for full analysis and a server-side reproduction with two curl requests. Approach pre-validated by @kamil-tekiela in the issue thread. Session fixation protection on successful login (AuthenticationCookie) is unchanged; logout/re-login still rotates the session id (verified on a live deployment).