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

Commit

Permalink
Add config option to hide device names over federation (#9945)
Browse files Browse the repository at this point in the history
Now that cross signing exists there is much less of a need for other people to look at devices and verify them individually. This PR adds a config option to allow you to prevent device display names from being shared with other servers.

Signed-off-by: Aaron Raimist <aaron@raim.ist>
  • Loading branch information
aaronraimist authored May 11, 2021
1 parent b378d98 commit dc6366a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/9945.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a config option to allow you to prevent device display names from being shared over federation. Contributed by @aaronraimist.
6 changes: 6 additions & 0 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,12 @@ acme:
#
#allow_profile_lookup_over_federation: false

# Uncomment to disable device display name lookup over federation. By default, the
# Federation API allows other homeservers to obtain device display names of any user
# on this homeserver. Defaults to 'true'.
#
#allow_device_name_lookup_over_federation: false


## Caching ##

Expand Down
10 changes: 10 additions & 0 deletions synapse/config/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def read_config(self, config, **kwargs):
"allow_profile_lookup_over_federation", True
)

self.allow_device_name_lookup_over_federation = config.get(
"allow_device_name_lookup_over_federation", True
)

def generate_config_section(self, config_dir_path, server_name, **kwargs):
return """\
## Federation ##
Expand Down Expand Up @@ -75,6 +79,12 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs):
# on this homeserver. Defaults to 'true'.
#
#allow_profile_lookup_over_federation: false
# Uncomment to disable device display name lookup over federation. By default, the
# Federation API allows other homeservers to obtain device display names of any user
# on this homeserver. Defaults to 'true'.
#
#allow_device_name_lookup_over_federation: false
"""


Expand Down
4 changes: 3 additions & 1 deletion synapse/storage/databases/main/end_to_end_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ async def get_e2e_device_keys_for_federation_query(
if keys:
result["keys"] = keys

device_display_name = device.display_name
device_display_name = None
if self.hs.config.allow_device_name_lookup_over_federation:
device_display_name = device.display_name
if device_display_name:
result["device_display_name"] = device_display_name

Expand Down

0 comments on commit dc6366a

Please sign in to comment.