Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Prevent local user profiles leaking when a "per-room profile" is changed #10695

Closed
wants to merge 48 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2b42abb
Fix passing `None` to DB helpers
Aug 25, 2021
ef0a9c5
Misc refactors
Aug 25, 2021
038a9c5
changelog stub
Aug 25, 2021
9366436
Docstrings, method reorder and rename
Aug 31, 2021
00f5809
Always load local users into user_directory
Aug 31, 2021
1819999
Remove unnecessary `set()` construction
Aug 31, 2021
bf97497
Only update remote users dir. entries from events
Aug 31, 2021
b348f0b
Refactor to remove a level of indentation
Aug 31, 2021
13d6b6e
test_profile: register a user, not just a profile
Aug 31, 2021
0d0f033
Use test-level "register_user", not the store
Aug 31, 2021
cca4d10
Missed an await GRR
Aug 31, 2021
137ecc8
Register user in RoomJoinRatelimitTestCase
Sep 1, 2021
dc25098
Need the admin servlet to register_user
Sep 1, 2021
90dcd65
Fix test: handler assumes lowercase username
Sep 1, 2021
d99eedb
Grrrrrr lint
Sep 1, 2021
ee72d78
Rename to clarify local versus remote name changes
Sep 2, 2021
61d3e88
Don't leak local users' per-room names on join
Sep 2, 2021
d643d14
Update synapse/handlers/user_directory.py
Sep 2, 2021
e77bbb2
Changelog
Sep 2, 2021
e0b5bde
Method rename again
Sep 2, 2021
3e547cb
Pull out the loop from _handle_deltas
Sep 2, 2021
6f25133
Exclude support users early
Sep 2, 2021
0933f33
Exclude events from app_services users early
Sep 2, 2021
b5b87ae
Handle `joined is MatchChange.now_false` in 1 spot
Sep 2, 2021
c9a099a
Test case for making a room public
Sep 2, 2021
4bde6b1
Remove redundant comment
Sep 2, 2021
8974d33
Only remove remote users from dir
Sep 2, 2021
9272ed9
Split apart _handle_add_user
Sep 2, 2021
a1bafa3
Lint
Sep 2, 2021
a75a3a1
Linttttttt
Sep 2, 2021
ea3037b
Remove unused arg from rem. profile change handler
Sep 3, 2021
f560472
Inline remote user joining room
Sep 3, 2021
359de94
Comment where we still have work TODO
Sep 3, 2021
474c212
Typing in storage module for user_directory
Sep 3, 2021
38bbde8
Comments about leakages
Sep 3, 2021
a3c023d
db user dir: pull out processing a room to method
Sep 3, 2021
90794cb
Exit early if process_single_room if not in room
Sep 3, 2021
e90524c
Describe data model in docs
Sep 3, 2021
bc9780f
Additional comments on the bg process
Sep 3, 2021
bbacf47
Linttttttt
Sep 3, 2021
6cca7c6
Update changelog
Sep 3, 2021
d50b492
Rationale for synapse test, not complement
Sep 3, 2021
0a217b9
Oliver's suggestions from code review.
Sep 3, 2021
9c4b7ef
Fixup docs as per review
Sep 3, 2021
8662e5f
Fix coment and extra check, as per review
Sep 3, 2021
8269250
Improve docstring for _handle_remove_user
Sep 3, 2021
401c1e8
Fix reactivated users not being added to directory (#10762)
Sep 8, 2021
2b0d714
Revert "Fix reactivated users not being added to directory (#10762)"
Sep 8, 2021
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
16 changes: 9 additions & 7 deletions synapse/handlers/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async def _handle_deltas(self, deltas: List[Dict[str, Any]]) -> None:
if joined is MatchChange.no_change:
# Handle any profile changes for remote users
if not self.is_mine_id(state_key):
await self._handle_profile_change(
await self._handle_possible_remote_profile_change(
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
state_key, room_id, prev_event_id, event_id
)

Expand Down Expand Up @@ -341,11 +341,13 @@ async def _handle_new_user(
room_id: The room ID that user joined or started being public
user_id
"""
logger.debug("Adding new user to dir, %r", user_id)

await self.store.update_profile_in_user_dir(
user_id, profile.display_name, profile.avatar_url
)
# Local users' directory entries are created and updated in tandem with
# their global profile, not in response to room events.
if not self.is_mine_id(user_id):
logger.debug("Adding new user to dir, %r", user_id)
await self.store.update_profile_in_user_dir(
user_id, profile.display_name, profile.avatar_url
)
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved

is_public = await self.store.is_room_world_readable_or_publicly_joinable(
room_id
Expand Down Expand Up @@ -405,7 +407,7 @@ async def _handle_remove_user(self, room_id: str, user_id: str) -> None:
if len(rooms_user_is_in) == 0:
await self.store.remove_from_user_dir(user_id)

async def _handle_profile_change(
async def _handle_possible_remote_profile_change(
self,
user_id: str,
room_id: str,
Expand Down