Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(email): Use a hash for the actor ID for better GDPR compliance
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Oct 23, 2024
commit dd4ca2d7ca4e922602d9cf016055782256e49c4b
5 changes: 3 additions & 2 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,15 @@ protected function invitedEmail(
string $accessToken,
): Response {
try {
$actorId = hash('sha256', $email);
$this->manager->getRoomByAccessToken(
$token,
Attendee::ACTOR_EMAILS,
$email,
$actorId,
$accessToken,
);
$this->talkSession->renewSessionId();
$this->talkSession->setAuthedEmailActorIdForRoom($token, $email);
$this->talkSession->setAuthedEmailActorIdForRoom($token, $actorId);
} catch (RoomNotFoundException) {
$redirectUrl = $this->url->linkToRoute('spreed.Page.index');
if ($token) {
Expand Down
12 changes: 10 additions & 2 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,12 @@ protected function formatParticipantList(array $participants, bool $includeStatu
$result['displayName'] = $participant->getAttendee()->getDisplayName();
} elseif ($participant->getAttendee()->getActorType() === Attendee::ACTOR_EMAILS) {
$result['displayName'] = $participant->getAttendee()->getDisplayName();
if ($this->participant->hasModeratorPermissions()) {
$result['status'] = IUserStatus::OFFLINE;
$result['statusIcon'] = null;
$result['statusMessage'] = $participant->getAttendee()->getInvitedCloudId();
$result['statusClearAt'] = null;
}
} elseif ($participant->getAttendee()->getActorType() === Attendee::ACTOR_FEDERATED_USERS) {
if ($participant->getSession() instanceof Session && $participant->getSession()->getLastPing() <= $maxPingAge) {
$this->participantService->leaveRoomAsSession($this->room, $participant);
Expand Down Expand Up @@ -1197,10 +1203,12 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
} catch (TypeException) {
}

$email = $newParticipant;
$actorId = hash('sha256', $email);
try {
$this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_EMAILS, $newParticipant);
$this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_EMAILS, $actorId);
} catch (ParticipantNotFoundException) {
$participant = $this->participantService->inviteEmailAddress($this->room, $newParticipant);
$participant = $this->participantService->inviteEmailAddress($this->room, $actorId, $email);
$this->guestManager->sendEmailInvitation($this->room, $participant);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/GuestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function sendEmailInvitation(Room $room, Participant $participant): void
if ($participant->getAttendee()->getActorType() !== Attendee::ACTOR_EMAILS) {
throw new \InvalidArgumentException('Cannot send email for non-email participant actor type');
}
$email = $participant->getAttendee()->getActorId();
$email = $participant->getAttendee()->getInvitedCloudId();
$pin = $participant->getAttendee()->getPin();

$event = new BeforeEmailInvitationSentEvent($room, $participant->getAttendee());
Expand Down
10 changes: 3 additions & 7 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,7 @@ public function addCircle(Room $room, Circle $circle, array $existingParticipant
$this->addUsers($room, $newParticipants, bansAlreadyChecked: true);
}

/**
* @param Room $room
* @param string $email
* @return Participant
*/
public function inviteEmailAddress(Room $room, string $email): Participant {
public function inviteEmailAddress(Room $room, string $actorId, string $email): Participant {
$lastMessage = 0;
if ($room->getLastMessage() instanceof IComment) {
$lastMessage = (int)$room->getLastMessage()->getId();
Expand All @@ -820,7 +815,8 @@ public function inviteEmailAddress(Room $room, string $email): Participant {
$attendee = new Attendee();
$attendee->setRoomId($room->getId());
$attendee->setActorType(Attendee::ACTOR_EMAILS);
$attendee->setActorId($email);
$attendee->setActorId($actorId);
$attendee->setInvitedCloudId($email);
$attendee->setAccessToken($this->secureRandom->generate(
FederationManager::TOKEN_LENGTH,
ISecureRandom::CHAR_HUMAN_READABLE
Expand Down