diff options
author | Joas Schilling <coding@schilljs.com> | 2017-07-19 16:40:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 16:40:18 +0200 |
commit | 3ff3c338c93c9d308f8160e28af08f3c59e9dbcc (patch) | |
tree | 8a4fb3c9122832f16feb3fc21592fefc7c421c73 | |
parent | 49c622fcbafe039c44d95595edfdda8a0cf7e042 (diff) | |
parent | 984933e5866c280eee34a8c2e16b0edcc94ac4d0 (diff) | |
download | nextcloud-server-3ff3c338c93c9d308f8160e28af08f3c59e9dbcc.tar.gz nextcloud-server-3ff3c338c93c9d308f8160e28af08f3c59e9dbcc.zip |
Merge pull request #5734 from nextcloud/only-readable-chars-in-share-tokens
Only use readable chars in Share Tokens
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 2 | ||||
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 3 | ||||
-rw-r--r-- | lib/private/Share/Share.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 8 |
4 files changed, 5 insertions, 11 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 7fe18cd8656..0193d3c2aae 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1925,7 +1925,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription public function setPublishStatus($value, $calendar) { $query = $this->db->getQueryBuilder(); if ($value) { - $publicUri = $this->random->generate(16, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); + $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE); $query->insert('dav_shares') ->values([ 'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()), diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index e584464dbff..32fa51d94a2 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -542,8 +542,7 @@ class ShareByMailProvider implements IShareProvider { * @return string */ protected function generateToken($size = 15) { - $token = $this->secureRandom->generate( - $size, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); + $token = $this->secureRandom->generate($size, ISecureRandom::CHAR_HUMAN_READABLE); return $token; } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index dc96d856ba6..8938c6f3066 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -913,8 +913,7 @@ class Share extends Constants { $token = $oldToken; } else { $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, - \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER. - \OCP\Security\ISecureRandom::CHAR_DIGITS + \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE ); } $result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 84b78a872ab..f64ae5d39ee 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -583,9 +583,7 @@ class Manager implements IManager { $share->setToken( $this->secureRandom->generate( \OC\Share\Constants::TOKEN_LENGTH, - \OCP\Security\ISecureRandom::CHAR_LOWER. - \OCP\Security\ISecureRandom::CHAR_UPPER. - \OCP\Security\ISecureRandom::CHAR_DIGITS + \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE ) ); @@ -603,9 +601,7 @@ class Manager implements IManager { $share->setToken( $this->secureRandom->generate( \OC\Share\Constants::TOKEN_LENGTH, - \OCP\Security\ISecureRandom::CHAR_LOWER. - \OCP\Security\ISecureRandom::CHAR_UPPER. - \OCP\Security\ISecureRandom::CHAR_DIGITS + \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE ) ); } |