Skip to content

Commit 274adbc

Browse files
docs(AppFramework): note why auth username is ignored in PasswordConfirmationMiddleware
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent 9ccb363 commit 274adbc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function beforeController(Controller $controller, string $methodName) {
9393
$this->session->set('last-password-confirm', $now);
9494
return;
9595
}
96-
96+
9797
$lastConfirm = (int)$this->session->get('last-password-confirm');
9898
$minimumRequiredConfirmTime = $now
9999
- (self::PASSWORD_CONFIRMATION_TIMEOUT + self::PASSWORD_CONFIRMATION_GRACE_SECONDS);
@@ -162,7 +162,8 @@ private function confirmPasswordFromAuthorizationHeader(): void {
162162
}
163163

164164
[$ignoredUser, $password] = explode(':', $decodedCredentials, 2);
165-
165+
// Use the session's loginname, not the one from the Authorization header,
166+
// to prevent credential stuffing against arbitrary usernames.
166167
$loginName = $this->session->get('loginname');
167168
$loginResult = $this->userManager->checkPassword($loginName, $password);
168169

0 commit comments

Comments
 (0)