Skip to content

Commit b7de544

Browse files
SystemKeeperbackportbot[bot]
authored andcommitted
fix: Use PHP_AUTH_PW for strict password confirmation
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
1 parent 24e0503 commit b7de544

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/private/AppFramework/Http/Request.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ public function getHeader(string $name): string {
272272
case 'CONTENT_TYPE':
273273
case 'CONTENT_LENGTH':
274274
case 'REMOTE_ADDR':
275+
case 'PHP_AUTH_USER':
276+
case 'PHP_AUTH_PW':
275277
if (isset($this->server[$name])) {
276278
return $this->server[$name];
277279
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ public function beforeController(Controller $controller, string $methodName) {
7676

7777
$reflectionMethod = new ReflectionMethod($controller, $methodName);
7878
if ($this->isPasswordConfirmationStrict($reflectionMethod)) {
79-
$authHeader = $this->request->getHeader('Authorization');
80-
if (!str_starts_with(strtolower($authHeader), 'basic ')) {
79+
$password = $this->request->getHeader('PHP_AUTH_PW');
80+
81+
if ($password === '') {
8182
throw new NotConfirmedException('Required authorization header missing');
8283
}
83-
[, $password] = explode(':', base64_decode(substr($authHeader, 6)), 2);
84+
8485
$loginName = $this->session->get('loginname');
8586
$loginResult = $this->userManager->checkPassword($loginName, $password);
8687
if ($loginResult === false) {

0 commit comments

Comments
 (0)