Skip to content

Commit dac4adf

Browse files
Merge pull request #1054 from nextcloud/backport/1051/stable23
[stable23] confirmKey must be uuid
2 parents a418d97 + b56768f commit dac4adf

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

lib/Service/RemoteStreamService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function getAppSignatory(bool $generate = true, string $confirmKey = ''):
133133
$this->fillSimpleSignatory($app, $generate);
134134
$app->setUidFromKey();
135135

136-
if ($confirmKey !== '') {
136+
if ($this->isUuid($confirmKey)) {
137137
$app->setAuthSigned($this->signString($confirmKey, $app));
138138
}
139139

lib/Tools/Traits/TStringTools.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ protected function uuid(int $length = 0): string {
8585
}
8686

8787

88+
/**
89+
* @param string $uuid
90+
*
91+
* @return bool
92+
*/
93+
protected function isUuid(string $uuid): bool {
94+
if ($uuid === '') {
95+
return false;
96+
}
97+
98+
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);
99+
}
100+
88101
/**
89102
* @param string $line
90103
* @param int $length

0 commit comments

Comments
 (0)