Skip to content

Commit 407f4cf

Browse files
authored
Merge pull request #507 from nextcloud/backport/505/stable-3.2
[stable-3.2] make testEncodedObjectGUID more robust against false positives
2 parents 8d87a97 + b28b5a3 commit 407f4cf

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

lib/UserBackend.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ public function updateAttributes($uid,
702702
*
703703
*/
704704
public function testEncodedObjectGUID(string $uid): string {
705+
if (preg_match('/[^a-zA-Z0-9=+\/]/', $uid) !== 0) {
706+
// certainly not encoded
707+
return $uid;
708+
}
709+
705710
$candidate = base64_decode($uid, false);
706711
if($candidate === false) {
707712
return $uid;

tests/unit/UserBackendTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public function objectGuidProvider() {
289289
['EDE70D16-B9D5-4E9A-ABD7-614D17246E3F', 'EDE70D16-B9D5-4E9A-ABD7-614D17246E3F'],
290290
['Tm8gY29udmVyc2lvbgo=', 'Tm8gY29udmVyc2lvbgo='],
291291
['ASfjU2OYEd69ZgAVF4pePA==', '53E32701-9863-DE11-BD66-0015178A5E3C'],
292+
['aaabbbcc@aa.bbbccdd.eee.ff', 'aaabbbcc@aa.bbbccdd.eee.ff'],
293+
['aaabbbcccaa.bbbccdddeee', 'aaabbbcccaa.bbbccdddeee']
292294
];
293295
}
294296

0 commit comments

Comments
 (0)