Skip to content

Commit

Permalink
Merge pull request #1053 from nextcloud/backport/1051/stable24
Browse files Browse the repository at this point in the history
[stable24] confirmKey must be uuid
  • Loading branch information
ArtificialOwl authored Jun 13, 2022
2 parents 37857df + 8ad0a30 commit 4c58092
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Service/RemoteStreamService.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getAppSignatory(bool $generate = true, string $confirmKey = ''):
$this->fillSimpleSignatory($app, $generate);
$app->setUidFromKey();

if ($confirmKey !== '') {
if ($this->isUuid($confirmKey)) {
$app->setAuthSigned($this->signString($confirmKey, $app));
}

Expand Down
13 changes: 13 additions & 0 deletions lib/Tools/Traits/TStringTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ protected function uuid(int $length = 0): string {
}


/**
* @param string $uuid
*
* @return bool
*/
protected function isUuid(string $uuid): bool {
if ($uuid === '') {
return false;
}

return (preg_match('/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i', $uuid) === 1);
}

/**
* @param string $line
* @param int $length
Expand Down

0 comments on commit 4c58092

Please sign in to comment.