Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Only use readable chars in Share Tokens
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jul 18, 2017
commit 984933e5866c280eee34a8c2e16b0edcc94ac4d0
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ public function getShares($resourceId) {
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()),
Expand Down
3 changes: 1 addition & 2 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,7 @@ protected function sendPasswordToOwner(IShare $share, $password) {
* @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;
}

Expand Down
3 changes: 1 addition & 2 deletions lib/private/Share/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ public static function shareItem($itemType, $itemSource, $shareType, $shareWith,
$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,
Expand Down
8 changes: 2 additions & 6 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,7 @@ public function createShare(\OCP\Share\IShare $share) {
$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
)
);

Expand All @@ -601,9 +599,7 @@ public function createShare(\OCP\Share\IShare $share) {
$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
)
);
}
Expand Down