Skip to content

Commit 2051c7b

Browse files
committed
fix: Use PHP_AUTH_PW for strict password confirmation
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
1 parent 7381273 commit 2051c7b

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
@@ -84,11 +84,12 @@ public function beforeController(Controller $controller, string $methodName) {
8484

8585
$reflectionMethod = new ReflectionMethod($controller, $methodName);
8686
if ($this->isPasswordConfirmationStrict($reflectionMethod)) {
87-
$authHeader = $this->request->getHeader('Authorization');
88-
if (!str_starts_with(strtolower($authHeader), 'basic ')) {
87+
$password = $this->request->getHeader('PHP_AUTH_PW');
88+
89+
if ($password === '') {
8990
throw new NotConfirmedException('Required authorization header missing');
9091
}
91-
[, $password] = explode(':', base64_decode(substr($authHeader, 6)), 2);
92+
9293
$loginName = $this->session->get('loginname');
9394
$loginResult = $this->userManager->checkPassword($loginName, $password);
9495
if ($loginResult === false) {

0 commit comments

Comments
 (0)