Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-04-10 11:25:32 +0300
committerJoas Schilling <coding@schilljs.com>2019-04-10 14:26:09 +0300
commit6436795b192f67601276054479a789803babab9b (patch)
treef7bbffbe1ac55262054f38d15779fbfec7c15b25 /lib
parent9ebd17dcc4df903781b1649650c5bb6d574a42cd (diff)
Remove conversation names and tokens when you are not a participant
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Manager.php17
-rw-r--r--lib/Share/Helper/ShareAPIController.php8
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/Manager.php b/lib/Manager.php
index 075e839bc..9e7e4fd03 100644
--- a/lib/Manager.php
+++ b/lib/Manager.php
@@ -583,13 +583,21 @@ class Manager {
if ($room->getType() === Room::CHANGELOG_CONVERSATION) {
return $this->l->t('Talk updates ✅');
}
+ if ($userId === '' && $room->getType() !== Room::PUBLIC_CALL) {
+ return $this->l->t('Private conversation');
+ }
+
if ($room->getType() !== Room::ONE_TO_ONE_CALL && $room->getName() === '') {
$room->setName($this->getRoomNameByParticipants($room));
}
// Set the room name to the other participant for one-to-one rooms
- if ($userId !== '' && $room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($userId === '') {
+ return $this->l->t('Private conversation');
+ }
+
$users = $room->getParticipantUserIds();
$otherParticipant = '';
$userIsParticipant = false;
@@ -616,6 +624,13 @@ class Manager {
return $otherParticipant;
}
+ try {
+ $room->getParticipant($userId);
+ } catch (ParticipantNotFoundException $e) {
+ // Do not leak the name of rooms the user is not a part of
+ return $this->l->t('Private conversation');
+ }
+
return $room->getName();
}
diff --git a/lib/Share/Helper/ShareAPIController.php b/lib/Share/Helper/ShareAPIController.php
index 64398f56a..04ecfdc4d 100644
--- a/lib/Share/Helper/ShareAPIController.php
+++ b/lib/Share/Helper/ShareAPIController.php
@@ -85,6 +85,14 @@ class ShareAPIController {
}
$result['share_with_displayname'] = $room->getDisplayName($this->userId);
+ try {
+ $room->getParticipant($this->userId);
+ } catch (ParticipantNotFoundException $e) {
+ // Removing the conversation token from the leaked data if not a participant.
+ // Adding some unique but reproducable part to the share_with here
+ // so the avatars for conversations are distinguishable
+ $result['share_with'] = 'private_conversation_' . substr(sha1($room->getName() . $room->getId()), 0, 6);
+ }
if ($room->getType() === Room::PUBLIC_CALL) {
$result['token'] = $share->getToken();
}