Merge pull request #22840 from nextcloud/backport/22770/stable19

[stable19] Mitigate encoding issue with user principal uri
This commit is contained in:
Morris Jobke 2020-09-14 17:16:38 +02:00 committed by GitHub
commit 380472d3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -168,7 +168,11 @@ class Principal implements BackendInterface {
}
if ($prefix === $this->principalPrefix) {
$user = $this->userManager->get($name);
// Depending on where it is called, it may happen that this function
// is called either with a urlencoded version of the name or with a non-urlencoded one.
// The urldecode function replaces %## and +, both of which are forbidden in usernames.
// Hence there can be no ambiguity here and it is safe to call urldecode on all usernames
$user = $this->userManager->get(urldecode($name));
if ($user !== null) {
return $this->userToPrincipal($user);