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

Commit dc6366a

Browse files
authored
Add config option to hide device names over federation (#9945)
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 <[email protected]>
1 parent b378d98 commit dc6366a

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

changelog.d/9945.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a config option to allow you to prevent device display names from being shared over federation. Contributed by @aaronraimist.

docs/sample_config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,12 @@ acme:
741741
#
742742
#allow_profile_lookup_over_federation: false
743743

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

745751
## Caching ##
746752

synapse/config/federation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def read_config(self, config, **kwargs):
4444
"allow_profile_lookup_over_federation", True
4545
)
4646

47+
self.allow_device_name_lookup_over_federation = config.get(
48+
"allow_device_name_lookup_over_federation", True
49+
)
50+
4751
def generate_config_section(self, config_dir_path, server_name, **kwargs):
4852
return """\
4953
## Federation ##
@@ -75,6 +79,12 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs):
7579
# on this homeserver. Defaults to 'true'.
7680
#
7781
#allow_profile_lookup_over_federation: false
82+
83+
# Uncomment to disable device display name lookup over federation. By default, the
84+
# Federation API allows other homeservers to obtain device display names of any user
85+
# on this homeserver. Defaults to 'true'.
86+
#
87+
#allow_device_name_lookup_over_federation: false
7888
"""
7989

8090

synapse/storage/databases/main/end_to_end_keys.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ async def get_e2e_device_keys_for_federation_query(
8484
if keys:
8585
result["keys"] = keys
8686

87-
device_display_name = device.display_name
87+
device_display_name = None
88+
if self.hs.config.allow_device_name_lookup_over_federation:
89+
device_display_name = device.display_name
8890
if device_display_name:
8991
result["device_display_name"] = device_display_name
9092

0 commit comments

Comments
 (0)